Documentation
¶
Index ¶
- type Any
- type Channel
- type Components
- type CorrelationID
- type Extensions
- type GoTypeImportExtension
- type GoTypeImportName
- type GoTypeImportPath
- type Info
- type Message
- type Operation
- type Parameter
- type Specification
- func (s Specification) CustomImports() ([]string, error)
- func (s Specification) GetPublishSubscribeCount() (publishCount, subscribeCount uint)
- func (s *Specification) Process()
- func (s Specification) ReferenceAny(ref string) *Any
- func (s Specification) ReferenceMessage(ref string) *Message
- func (s Specification) ReferenceParameter(ref string) *Parameter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Any ¶
type Any struct { AllOf []*Any `json:"allOf"` AnyOf []*Any `json:"anyOf"` OneOf []*Any `json:"oneOf"` Type string `json:"type"` Description string `json:"description"` Format string `json:"format"` Properties map[string]*Any `json:"properties"` Items *Any `json:"items"` Reference string `json:"$ref"` Required []string `json:"required"` // Non AsyncAPI fields Name string `json:"-"` ReferenceTo *Any `json:"-"` IsRequired bool `json:"-"` // Embedded extended fields Extensions }
func (Any) IsFieldRequired ¶ added in v0.4.0
func (*Any) MergeWith ¶ added in v0.9.0
func (a *Any) MergeWith(spec Specification, a2 Any)
type Channel ¶
type Channel struct { Parameters map[string]*Parameter `json:"parameters"` Subscribe *Operation `json:"subscribe"` Publish *Operation `json:"publish"` // Non AsyncAPI fields Name string `json:"-"` Path string `json:"-"` }
func (Channel) GetChannelMessage ¶ added in v0.2.0
GetChannelMessage will return the channel message WARNING: if there is a reference, then it won't be followed.
func (*Channel) Process ¶ added in v0.2.0
func (c *Channel) Process(path string, spec Specification)
type Components ¶
type Components struct { Messages map[string]*Message `json:"messages"` Schemas map[string]*Any `json:"schemas"` Parameters map[string]*Parameter `json:"parameters"` }
func (*Components) Process ¶ added in v0.2.0
func (c *Components) Process(spec Specification)
type CorrelationID ¶ added in v0.1.1
type Extensions ¶ added in v0.18.0
type Extensions struct { // Setting custom Go type when generating schemas ExtGoType string `json:"x-go-type"` // Setting custom import statements for ExtGoType ExtGoTypeImport *GoTypeImportExtension `json:"x-go-type-import"` }
Extensions holds additional properties defined for asyncapi-codegen that are out of the AsyncAPI spec.
type GoTypeImportExtension ¶ added in v0.18.0
type GoTypeImportExtension struct { Name GoTypeImportName `json:"name"` // Package name for import, optional Path GoTypeImportPath `json:"path"` // Path to package to import }
GoTypeImportExtension specifies the required import statement for the x-go-type extension. For example, GoTypeImportExtension{Name: "myuuid", Path: "github.com/google/uuid"} will generate `import myuuid github.com/google/uuid`
type GoTypeImportName ¶ added in v0.18.0
type GoTypeImportName string // Import name type for x-go-type-import
type GoTypeImportPath ¶ added in v0.18.0
type GoTypeImportPath string // Import path type for x-go-type-import
type Message ¶
type Message struct { Description string `json:"description"` Headers *Any `json:"headers"` OneOf []*Message `json:"oneOf"` Payload *Any `json:"payload"` CorrelationID *CorrelationID `json:"correlationID"` Reference string `json:"$ref"` // --- Non AsyncAPI fields ------------------------------------------------- Name string `json:"-"` ReferenceTo *Message `json:"-"` // CorrelationIDLocation will indicate where the correlation id is // According to: https://www.asyncapi.com/docs/reference/specification/v2.6.0#correlationIDObject CorrelationIDLocation string `json:"-"` CorrelationIDRequired bool `json:"-"` }
func (*Message) MergeWith ¶ added in v0.9.0
func (msg *Message) MergeWith(spec Specification, msg2 Message)
func (*Message) Process ¶ added in v0.2.0
func (msg *Message) Process(name string, spec Specification)
type Parameter ¶ added in v0.9.0
type Parameter struct { Description string `json:"description"` Schema *Any `json:"schema"` Location string `json:"location"` Reference string `json:"$ref"` // Non AsyncAPI fields Name string `json:"-"` ReferenceTo *Parameter `json:"-"` }
func (*Parameter) Process ¶ added in v0.9.0
func (p *Parameter) Process(name string, spec Specification)
type Specification ¶
type Specification struct { Version string `json:"asyncapi"` Info Info `json:"info"` Channels map[string]*Channel `json:"channels"` Components Components `json:"components"` }
func (Specification) CustomImports ¶ added in v0.18.0
func (s Specification) CustomImports() ([]string, error)
CustomImports collects all custom import paths set by x-go-type-imports in all Schema Objects in the Specification. Returns import strings like `alias "abc.xyz/repo/package"` for code generation. Returns error when import name conflicts.
func (Specification) GetPublishSubscribeCount ¶ added in v0.1.2
func (s Specification) GetPublishSubscribeCount() (publishCount, subscribeCount uint)
GetPublishSubscribeCount gets the count of 'publish' channels and the count of 'subscribe' channels inside the Specification
func (*Specification) Process ¶
func (s *Specification) Process()
func (Specification) ReferenceAny ¶ added in v0.5.0
func (s Specification) ReferenceAny(ref string) *Any
func (Specification) ReferenceMessage ¶
func (s Specification) ReferenceMessage(ref string) *Message
func (Specification) ReferenceParameter ¶ added in v0.12.0
func (s Specification) ReferenceParameter(ref string) *Parameter