Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidFileFormat is returned when using an invalid format for AsyncAPI specification. ErrInvalidFileFormat = fmt.Errorf("%w: invalid file format", extensions.ErrAsyncAPI) // ErrInvalidVersion is returned when the version is either unsupported or invalid. ErrInvalidVersion = fmt.Errorf("%w: unsupported/invalid version", extensions.ErrAsyncAPI) )
Functions ¶
func FromFile ¶
func FromFile(params FromFileParams) (asyncapi.Specification, error)
FromFile parses the AsyncAPI specification either from a YAML file or a JSON file. If there is no version provided, it will try to get it from the specification.
NOTE: It returns the Specification with filled fields, but this doesn't generate metadata, link references, apply traits, etc. You have to call method `Process` for this.
func FromJSON ¶
func FromJSON(params FromJSONParams) (asyncapi.Specification, error)
FromJSON parses the AsyncAPI specification from a JSON file. If there is no version provided, it will try to get it from the specification.
NOTE: It returns the Specification with filled fields, but this doesn't link references, apply traits, etc. You have to call method `Process` for this.
func FromYAML ¶
func FromYAML(params FromYAMLParams) (asyncapi.Specification, error)
FromYAML parses the AsyncAPI specification from a YAML file. If there is no version provided, it will try to get it from the specification.
NOTE: It returns the Specification with filled fields, but this doesn't link references, apply traits, etc. You have to call method `Process` for this.
Types ¶
type FromFileParams ¶
type FromFileParams struct { // Path to the file that contains the AsyncAPI specification. Path string // MajorVersion is the major version of the AsyncAPI specification. // If it is 0, it will try to get it from the specification. MajorVersion int }
FromFileParams are the parameters to parse an AsyncAPI specification from a file.
type FromJSONParams ¶
type FromJSONParams struct { // Cata is the content of the JSON that contains the AsyncAPI specification. Data []byte // MajorVersion is the major version of the AsyncAPI specification. // If it is 0, it will try to get it from the specification. MajorVersion int }
FromJSONParams are the parameters to parse an AsyncAPI specification from a JSON file.
type FromYAMLParams ¶
type FromYAMLParams struct { // Cata is the content of the YAML that contains the AsyncAPI specification. Data []byte // MajorVersion is the major version of the AsyncAPI specification. // If it is 0, it will try to get it from the specification. MajorVersion int }
FromYAMLParams are the parameters to parse an AsyncAPI specification from a YAML file.