Documentation
¶
Index ¶
- func BuildMessages(entries []*parser.SchemaEntry, ctx *Context) (*internal.DependencyGraph, error)
- func Generate(packageName string, packagePath string, ctx *Context) ([]byte, error)
- func MapScalarType(ctx *Context, typ, format string) (string, error)
- func ProtoType(schema *base.Schema, propertyName string, propProxy *base.SchemaProxy, ...) (string, bool, []string, error)
- func ResolveArrayItemType(schema *base.Schema, propertyName string, propProxy *base.SchemaProxy, ...) (string, []string, error)
- type Context
- type ProtoEnum
- type ProtoEnumValue
- type ProtoField
- type ProtoMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildMessages ¶
func BuildMessages(entries []*parser.SchemaEntry, ctx *Context) (*internal.DependencyGraph, error)
BuildMessages processes all schemas and returns messages and dependency graph
func MapScalarType ¶
MapScalarType maps OpenAPI type+format to proto3 scalar type.
func ProtoType ¶
func ProtoType(schema *base.Schema, propertyName string, propProxy *base.SchemaProxy, ctx *Context, parentMsg *ProtoMessage) (string, bool, []string, error)
ProtoType returns the proto3 type for an OpenAPI schema. Returns type name, whether it's repeated, enum values (for string enums), and error. For inline enums and objects, hoists them appropriately in the context. parentMsg is used for nested messages (can be nil for top-level).
func ResolveArrayItemType ¶
func ResolveArrayItemType(schema *base.Schema, propertyName string, propProxy *base.SchemaProxy, ctx *Context, parentMsg *ProtoMessage) (string, []string, error)
ResolveArrayItemType determines the proto3 type for array items. Returns type name, enum values (for string enums), and error. For inline objects/enums: validates property name is not plural.
Types ¶
type Context ¶
type Context struct {
Tracker *internal.NameTracker
Messages []*ProtoMessage
Enums []*ProtoEnum
Definitions []interface{} // Mixed enums and messages in processing order
UsesTimestamp bool
}
Context holds state during conversion
type ProtoEnum ¶
type ProtoEnum struct {
Name string
Description string
Values []*ProtoEnumValue
}
ProtoEnum represents a proto3 enum definition
type ProtoEnumValue ¶
ProtoEnumValue represents an enum value
type ProtoField ¶
type ProtoField struct {
Name string
Type string
Number int
JSONName string
Description string
Repeated bool
EnumValues []string
}
ProtoField represents a proto3 field
type ProtoMessage ¶
type ProtoMessage struct {
Name string
Description string
Fields []*ProtoField
Nested []*ProtoMessage
OriginalSchema string // Original schema name before name tracker renaming
}
ProtoMessage represents a proto3 message definition