Documentation
¶
Index ¶
- type AsyncAPIChannel
- type AsyncAPIComponents
- type AsyncAPIContact
- type AsyncAPICorrelationId
- type AsyncAPIExternalDocs
- type AsyncAPIInfo
- type AsyncAPILicense
- type AsyncAPIMessage
- type AsyncAPIOperation
- type AsyncAPIOperationReply
- type AsyncAPIParameter
- type AsyncAPIReplyAddress
- type AsyncAPISchema
- type AsyncAPISecurityScheme
- type AsyncAPIServer
- type AsyncAPISpec
- type AsyncAPITag
- type Generator
- func (g *Generator) Generate(exchange, version, title, apiType string, servers []string) error
- func (g *Generator) GenerateEndpoints(exchange, version, apiType string, endpoints []parser.Endpoint) error
- func (g *Generator) GenerateWebSocket(exchange, version, title, apiType string, servers map[string][]string) error
- func (g *Generator) GenerateWebSocketEndpoints(exchange, version, apiType string, channels []wsParser.Channel) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncAPIChannel ¶ added in v0.2.1
type AsyncAPIChannel struct {
Address string `json:"address,omitempty" yaml:"address,omitempty"`
Title string `json:"title,omitempty" yaml:"title,omitempty"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Messages map[string]*AsyncAPIMessage `json:"messages,omitempty" yaml:"messages,omitempty"`
Parameters map[string]*AsyncAPIParameter `json:"parameters,omitempty" yaml:"parameters,omitempty"`
Servers []map[string]string `json:"servers,omitempty" yaml:"servers,omitempty"`
Bindings map[string]interface{} `json:"bindings,omitempty" yaml:"bindings,omitempty"`
Tags []*AsyncAPITag `json:"tags,omitempty" yaml:"tags,omitempty"`
ExternalDocs *AsyncAPIExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
}
AsyncAPIChannel represents a channel in AsyncAPI 3.0.0
type AsyncAPIComponents ¶ added in v0.2.1
type AsyncAPIComponents struct {
Schemas map[string]*AsyncAPISchema `json:"schemas,omitempty" yaml:"schemas,omitempty"`
Messages map[string]*AsyncAPIMessage `json:"messages,omitempty" yaml:"messages,omitempty"`
SecuritySchemes map[string]*AsyncAPISecurityScheme `json:"securitySchemes,omitempty" yaml:"securitySchemes,omitempty"`
Parameters map[string]*AsyncAPIParameter `json:"parameters,omitempty" yaml:"parameters,omitempty"`
Channels map[string]*AsyncAPIChannel `json:"channels,omitempty" yaml:"channels,omitempty"`
Operations map[string]*AsyncAPIOperation `json:"operations,omitempty" yaml:"operations,omitempty"`
Replies map[string]*AsyncAPIOperationReply `json:"replies,omitempty" yaml:"replies,omitempty"`
ReplyAddresses map[string]*AsyncAPIReplyAddress `json:"replyAddresses,omitempty" yaml:"replyAddresses,omitempty"`
Tags map[string]*AsyncAPITag `json:"tags,omitempty" yaml:"tags,omitempty"`
ExternalDocs map[string]*AsyncAPIExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
}
AsyncAPIComponents represents the components section in AsyncAPI 3.0.0
type AsyncAPIContact ¶ added in v0.2.1
type AsyncAPIContact struct {
Name string `json:"name,omitempty" yaml:"name,omitempty"`
URL string `json:"url,omitempty" yaml:"url,omitempty"`
Email string `json:"email,omitempty" yaml:"email,omitempty"`
}
AsyncAPIContact represents contact information
type AsyncAPICorrelationId ¶ added in v0.2.1
type AsyncAPICorrelationId struct {
Location string `json:"location,omitempty" yaml:"location,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
}
AsyncAPICorrelationId represents correlation ID for request-reply
type AsyncAPIExternalDocs ¶ added in v0.2.1
type AsyncAPIExternalDocs struct {
Description string `json:"description,omitempty" yaml:"description,omitempty"`
URL string `json:"url" yaml:"url"`
}
AsyncAPIExternalDocs represents external documentation
type AsyncAPIInfo ¶ added in v0.2.1
type AsyncAPIInfo struct {
Title string `json:"title" yaml:"title"`
Version string `json:"version" yaml:"version"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
TermsOfService string `json:"termsOfService,omitempty" yaml:"termsOfService,omitempty"`
Contact *AsyncAPIContact `json:"contact,omitempty" yaml:"contact,omitempty"`
License *AsyncAPILicense `json:"license,omitempty" yaml:"license,omitempty"`
Tags []*AsyncAPITag `json:"tags,omitempty" yaml:"tags,omitempty"`
ExternalDocs *AsyncAPIExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
}
AsyncAPIInfo represents the info object in AsyncAPI 3.0.0
type AsyncAPILicense ¶ added in v0.2.1
type AsyncAPILicense struct {
Name string `json:"name" yaml:"name"`
URL string `json:"url,omitempty" yaml:"url,omitempty"`
}
AsyncAPILicense represents license information
type AsyncAPIMessage ¶ added in v0.2.1
type AsyncAPIMessage struct {
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Title string `json:"title,omitempty" yaml:"title,omitempty"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Tags []*AsyncAPITag `json:"tags,omitempty" yaml:"tags,omitempty"`
Headers *AsyncAPISchema `json:"headers,omitempty" yaml:"headers,omitempty"`
Payload *AsyncAPISchema `json:"payload,omitempty" yaml:"payload,omitempty"`
Examples []interface{} `json:"examples,omitempty" yaml:"examples,omitempty"`
Bindings map[string]interface{} `json:"bindings,omitempty" yaml:"bindings,omitempty"`
Traits []interface{} `json:"traits,omitempty" yaml:"traits,omitempty"`
CorrelationId *AsyncAPICorrelationId `json:"correlationId,omitempty" yaml:"correlationId,omitempty"`
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
Extensions map[string]interface{} `json:"-" yaml:",inline"` // For x-* extension fields
}
AsyncAPIMessage represents a message
type AsyncAPIOperation ¶ added in v0.2.1
type AsyncAPIOperation struct {
Title string `json:"title,omitempty" yaml:"title,omitempty"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Action string `json:"action" yaml:"action"` // "send" or "receive"
Channel map[string]string `json:"channel" yaml:"channel"` // $ref to channel
Messages []map[string]string `json:"messages,omitempty" yaml:"messages,omitempty"`
Reply *AsyncAPIOperationReply `json:"reply,omitempty" yaml:"reply,omitempty"`
Tags []*AsyncAPITag `json:"tags,omitempty" yaml:"tags,omitempty"`
Bindings map[string]interface{} `json:"bindings,omitempty" yaml:"bindings,omitempty"`
Traits []interface{} `json:"traits,omitempty" yaml:"traits,omitempty"`
Security []map[string]interface{} `json:"security,omitempty" yaml:"security,omitempty"` // Can be requirements or references
ExternalDocs *AsyncAPIExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
Extensions map[string]interface{} `json:"-" yaml:",inline"` // For x-* extension fields
}
AsyncAPIOperation represents an operation in AsyncAPI 3.0.0
type AsyncAPIOperationReply ¶ added in v0.2.1
type AsyncAPIOperationReply struct {
Address *AsyncAPIReplyAddress `json:"address,omitempty" yaml:"address,omitempty"`
Channel map[string]string `json:"channel,omitempty" yaml:"channel,omitempty"`
Messages []map[string]string `json:"messages,omitempty" yaml:"messages,omitempty"`
}
AsyncAPIOperationReply represents the reply object for request-reply pattern
type AsyncAPIParameter ¶ added in v0.2.1
type AsyncAPIParameter struct {
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Default interface{} `json:"default,omitempty" yaml:"default,omitempty"`
Enum []interface{} `json:"enum,omitempty" yaml:"enum,omitempty"`
Examples []interface{} `json:"examples,omitempty" yaml:"examples,omitempty"`
Location string `json:"location,omitempty" yaml:"location,omitempty"`
}
AsyncAPIParameter represents a parameter in AsyncAPI 3.0.0
type AsyncAPIReplyAddress ¶ added in v0.2.1
type AsyncAPIReplyAddress struct {
Location string `json:"location,omitempty" yaml:"location,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
}
AsyncAPIReplyAddress represents the reply address
type AsyncAPISchema ¶ added in v0.2.1
type AsyncAPISchema struct {
Type string `json:"type,omitempty" yaml:"type,omitempty"`
Format string `json:"format,omitempty" yaml:"format,omitempty"`
Title string `json:"title,omitempty" yaml:"title,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Default interface{} `json:"default,omitempty" yaml:"default,omitempty"`
Example interface{} `json:"example,omitempty" yaml:"example,omitempty"`
Enum []interface{} `json:"enum,omitempty" yaml:"enum,omitempty"`
Const interface{} `json:"const,omitempty" yaml:"const,omitempty"`
Properties map[string]*AsyncAPISchema `json:"properties,omitempty" yaml:"properties,omitempty"`
Items *AsyncAPISchema `json:"items,omitempty" yaml:"items,omitempty"`
Required []string `json:"required,omitempty" yaml:"required,omitempty"`
AdditionalProperties *AsyncAPISchema `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty"`
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
}
AsyncAPISchema represents a schema in AsyncAPI 3.0.0
type AsyncAPISecurityScheme ¶ added in v0.2.1
type AsyncAPISecurityScheme struct {
Type string `json:"type" yaml:"type"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
In string `json:"in,omitempty" yaml:"in,omitempty"`
Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"`
// For OAuth2
Flows map[string]interface{} `json:"flows,omitempty" yaml:"flows,omitempty"`
}
AsyncAPISecurityScheme represents a security scheme
type AsyncAPIServer ¶ added in v0.2.1
type AsyncAPIServer struct {
Host string `json:"host" yaml:"host"`
Pathname string `json:"pathname,omitempty" yaml:"pathname,omitempty"`
Protocol string `json:"protocol" yaml:"protocol"`
Title string `json:"title,omitempty" yaml:"title,omitempty"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Variables map[string]interface{} `json:"variables,omitempty" yaml:"variables,omitempty"`
Security []map[string][]string `json:"security,omitempty" yaml:"security,omitempty"`
Bindings map[string]interface{} `json:"bindings,omitempty" yaml:"bindings,omitempty"`
ExternalDocs *AsyncAPIExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
}
AsyncAPIServer represents a server in AsyncAPI 3.0.0
type AsyncAPISpec ¶ added in v0.2.1
type AsyncAPISpec struct {
AsyncAPI string `json:"asyncapi" yaml:"asyncapi"`
ID string `json:"id,omitempty" yaml:"id,omitempty"`
Info *AsyncAPIInfo `json:"info" yaml:"info"`
Servers map[string]*AsyncAPIServer `json:"servers,omitempty" yaml:"servers,omitempty"`
Channels map[string]*AsyncAPIChannel `json:"channels,omitempty" yaml:"channels,omitempty"`
Operations map[string]*AsyncAPIOperation `json:"operations,omitempty" yaml:"operations,omitempty"`
Components *AsyncAPIComponents `json:"components,omitempty" yaml:"components,omitempty"`
}
AsyncAPISpec represents an AsyncAPI 3.0.0 specification
type AsyncAPITag ¶ added in v0.2.1
type AsyncAPITag struct {
Name string `json:"name" yaml:"name"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
ExternalDocs *AsyncAPIExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
}
AsyncAPITag represents a tag
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator handles the generation of OpenAPI specifications
func NewGenerator ¶
NewGenerator creates a new OpenAPI specification generator
func (*Generator) GenerateEndpoints ¶
func (g *Generator) GenerateEndpoints(exchange, version, apiType string, endpoints []parser.Endpoint) error
GenerateEndpoints generates an OpenAPI specification for each endpoint