Help us shape the future of Go! Take the 2026 Go Developer Survey

core

package
v1.25.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Contact

type Contact struct {
	marshaller.CoreModel `model:"contact"`

	Name       marshaller.Node[*string] `key:"name"`
	URL        marshaller.Node[*string] `key:"url"`
	Email      marshaller.Node[*string] `key:"email"`
	Extensions core.Extensions          `key:"extensions"`
}

Contact information for the exposed API.

type Examples

Examples is a map of MIME types to example values.

type ExternalDocumentation

type ExternalDocumentation struct {
	marshaller.CoreModel `model:"externalDocumentation"`

	Description marshaller.Node[*string] `key:"description"`
	URL         marshaller.Node[string]  `key:"url"`
	Extensions  core.Extensions          `key:"extensions"`
}

ExternalDocumentation allows referencing an external resource for extended documentation.

type Header struct {
	marshaller.CoreModel `model:"header"`

	Description      marshaller.Node[*string]                         `key:"description"`
	Type             marshaller.Node[string]                          `key:"type"`
	Format           marshaller.Node[*string]                         `key:"format"`
	Items            marshaller.Node[*Items]                          `key:"items"`
	CollectionFormat marshaller.Node[*string]                         `key:"collectionFormat"`
	Default          marshaller.Node[values.Value]                    `key:"default"`
	Maximum          marshaller.Node[*float64]                        `key:"maximum"`
	ExclusiveMaximum marshaller.Node[*bool]                           `key:"exclusiveMaximum"`
	Minimum          marshaller.Node[*float64]                        `key:"minimum"`
	ExclusiveMinimum marshaller.Node[*bool]                           `key:"exclusiveMinimum"`
	MaxLength        marshaller.Node[*int64]                          `key:"maxLength"`
	MinLength        marshaller.Node[*int64]                          `key:"minLength"`
	Pattern          marshaller.Node[*string]                         `key:"pattern"`
	MaxItems         marshaller.Node[*int64]                          `key:"maxItems"`
	MinItems         marshaller.Node[*int64]                          `key:"minItems"`
	UniqueItems      marshaller.Node[*bool]                           `key:"uniqueItems"`
	Enum             marshaller.Node[[]marshaller.Node[values.Value]] `key:"enum"`
	MultipleOf       marshaller.Node[*float64]                        `key:"multipleOf"`
	Extensions       core.Extensions                                  `key:"extensions"`
}

Header describes a single header in a response.

type Headers

Headers is a map of header names to header definitions.

type Info

type Info struct {
	marshaller.CoreModel `model:"info"`

	Title          marshaller.Node[string]   `key:"title"`
	Description    marshaller.Node[*string]  `key:"description"`
	TermsOfService marshaller.Node[*string]  `key:"termsOfService"`
	Contact        marshaller.Node[*Contact] `key:"contact"`
	License        marshaller.Node[*License] `key:"license"`
	Version        marshaller.Node[string]   `key:"version"`
	Extensions     core.Extensions           `key:"extensions"`
}

Info provides metadata about the API.

type Items

type Items struct {
	marshaller.CoreModel `model:"items"`

	Type             marshaller.Node[string]                          `key:"type"`
	Format           marshaller.Node[*string]                         `key:"format"`
	Items            marshaller.Node[*Items]                          `key:"items"`
	CollectionFormat marshaller.Node[*string]                         `key:"collectionFormat"`
	Default          marshaller.Node[values.Value]                    `key:"default"`
	Maximum          marshaller.Node[*float64]                        `key:"maximum"`
	ExclusiveMaximum marshaller.Node[*bool]                           `key:"exclusiveMaximum"`
	Minimum          marshaller.Node[*float64]                        `key:"minimum"`
	ExclusiveMinimum marshaller.Node[*bool]                           `key:"exclusiveMinimum"`
	MaxLength        marshaller.Node[*int64]                          `key:"maxLength"`
	MinLength        marshaller.Node[*int64]                          `key:"minLength"`
	Pattern          marshaller.Node[*string]                         `key:"pattern"`
	MaxItems         marshaller.Node[*int64]                          `key:"maxItems"`
	MinItems         marshaller.Node[*int64]                          `key:"minItems"`
	UniqueItems      marshaller.Node[*bool]                           `key:"uniqueItems"`
	Enum             marshaller.Node[[]marshaller.Node[values.Value]] `key:"enum"`
	MultipleOf       marshaller.Node[*float64]                        `key:"multipleOf"`

	Extensions core.Extensions `key:"extensions"`
}

Items is a limited subset of JSON-Schema's items object for array parameters.

type License

type License struct {
	marshaller.CoreModel `model:"license"`

	Name       marshaller.Node[string]  `key:"name"`
	URL        marshaller.Node[*string] `key:"url"`
	Extensions core.Extensions          `key:"extensions"`
}

License information for the exposed API.

type Operation

type Operation struct {
	marshaller.CoreModel `model:"operation"`

	Tags         marshaller.Node[[]string]                                  `key:"tags"`
	Summary      marshaller.Node[*string]                                   `key:"summary"`
	Description  marshaller.Node[*string]                                   `key:"description"`
	ExternalDocs marshaller.Node[*ExternalDocumentation]                    `key:"externalDocs"`
	OperationID  marshaller.Node[*string]                                   `key:"operationId"`
	Consumes     marshaller.Node[[]string]                                  `key:"consumes"`
	Produces     marshaller.Node[[]string]                                  `key:"produces"`
	Parameters   marshaller.Node[[]marshaller.Node[*Reference[*Parameter]]] `key:"parameters"`
	Responses    marshaller.Node[Responses]                                 `key:"responses"`
	Schemes      marshaller.Node[[]string]                                  `key:"schemes"`
	Deprecated   marshaller.Node[*bool]                                     `key:"deprecated"`
	Security     marshaller.Node[[]marshaller.Node[*SecurityRequirement]]   `key:"security"`
	Extensions   core.Extensions                                            `key:"extensions"`
}

Operation describes a single API operation on a path.

type Parameter

type Parameter struct {
	marshaller.CoreModel `model:"parameter"`

	// Common fields for all parameter types
	Name        marshaller.Node[string]  `key:"name"`
	In          marshaller.Node[string]  `key:"in"`
	Description marshaller.Node[*string] `key:"description"`
	Required    marshaller.Node[*bool]   `key:"required"`

	// For body parameters
	Schema marshaller.Node[oascore.JSONSchema] `key:"schema"`

	// For non-body parameters
	Type             marshaller.Node[*string]                         `key:"type"`
	Format           marshaller.Node[*string]                         `key:"format"`
	AllowEmptyValue  marshaller.Node[*bool]                           `key:"allowEmptyValue"`
	Items            marshaller.Node[*Items]                          `key:"items"`
	CollectionFormat marshaller.Node[*string]                         `key:"collectionFormat"`
	Default          marshaller.Node[values.Value]                    `key:"default"`
	Maximum          marshaller.Node[*float64]                        `key:"maximum"`
	ExclusiveMaximum marshaller.Node[*bool]                           `key:"exclusiveMaximum"`
	Minimum          marshaller.Node[*float64]                        `key:"minimum"`
	ExclusiveMinimum marshaller.Node[*bool]                           `key:"exclusiveMinimum"`
	MaxLength        marshaller.Node[*int64]                          `key:"maxLength"`
	MinLength        marshaller.Node[*int64]                          `key:"minLength"`
	Pattern          marshaller.Node[*string]                         `key:"pattern"`
	MaxItems         marshaller.Node[*int64]                          `key:"maxItems"`
	MinItems         marshaller.Node[*int64]                          `key:"minItems"`
	UniqueItems      marshaller.Node[*bool]                           `key:"uniqueItems"`
	Enum             marshaller.Node[[]marshaller.Node[values.Value]] `key:"enum"`
	MultipleOf       marshaller.Node[*float64]                        `key:"multipleOf"`

	Extensions core.Extensions `key:"extensions"`
}

Parameter describes a single operation parameter.

type PathItem

type PathItem struct {
	marshaller.CoreModel `model:"pathItem"`
	*sequencedmap.Map[string, marshaller.Node[*Operation]]

	Ref        marshaller.Node[*string]                  `key:"$ref"`
	Parameters marshaller.Node[[]*Reference[*Parameter]] `key:"parameters"`
	Extensions core.Extensions                           `key:"extensions"`
}

PathItem describes the operations available on a single path.

func NewPathItem

func NewPathItem() *PathItem

func (*PathItem) GetMapKeyNodeOrRoot

func (p *PathItem) GetMapKeyNodeOrRoot(key string, rootNode *yaml.Node) *yaml.Node

func (*PathItem) GetMapKeyNodeOrRootLine

func (p *PathItem) GetMapKeyNodeOrRootLine(key string, rootNode *yaml.Node) int

type Paths

type Paths struct {
	marshaller.CoreModel `model:"paths"`
	*sequencedmap.Map[string, marshaller.Node[*PathItem]]

	Extensions core.Extensions `key:"extensions"`
}

Paths holds the relative paths to the individual endpoints.

func NewPaths

func NewPaths() *Paths

func (*Paths) GetMapKeyNodeOrRoot

func (p *Paths) GetMapKeyNodeOrRoot(key string, rootNode *yaml.Node) *yaml.Node

func (*Paths) GetMapKeyNodeOrRootLine

func (p *Paths) GetMapKeyNodeOrRootLine(key string, rootNode *yaml.Node) int

type Reference

type Reference[T marshaller.CoreModeler] struct {
	marshaller.CoreModel `model:"reference"`

	Reference marshaller.Node[*string] `key:"$ref"`
	Object    T                        `populatorValue:"true"`
}

Reference represents either a reference to a component or an inline object.

func (*Reference[T]) SyncChanges

func (r *Reference[T]) SyncChanges(ctx context.Context, model any, valueNode *yaml.Node) (*yaml.Node, error)

func (*Reference[T]) Unmarshal

func (r *Reference[T]) Unmarshal(ctx context.Context, parentName string, node *yaml.Node) ([]error, error)

type Response

type Response struct {
	marshaller.CoreModel `model:"response"`

	Description marshaller.Node[string]             `key:"description"`
	Schema      marshaller.Node[oascore.JSONSchema] `key:"schema"`
	Headers     marshaller.Node[*Headers]           `key:"headers"`
	Examples    marshaller.Node[*Examples]          `key:"examples"`
	Extensions  core.Extensions                     `key:"extensions"`
}

Response describes a single response from an API operation.

type Responses

type Responses struct {
	marshaller.CoreModel `model:"responses"`
	*sequencedmap.Map[string, marshaller.Node[*Reference[*Response]]]

	Default    marshaller.Node[*Reference[*Response]] `key:"default"`
	Extensions core.Extensions                        `key:"extensions"`
}

Responses is a container for the expected responses of an operation.

func NewResponses

func NewResponses() *Responses

func (*Responses) GetMapKeyNodeOrRoot

func (r *Responses) GetMapKeyNodeOrRoot(key string, rootNode *yaml.Node) *yaml.Node

func (*Responses) GetMapKeyNodeOrRootLine

func (r *Responses) GetMapKeyNodeOrRootLine(key string, rootNode *yaml.Node) int

type SecurityRequirement

type SecurityRequirement struct {
	marshaller.CoreModel `model:"securityRequirement"`
	*sequencedmap.Map[string, marshaller.Node[[]string]]
}

SecurityRequirement lists the required security schemes to execute an operation.

func NewSecurityRequirement

func NewSecurityRequirement() *SecurityRequirement

type SecurityScheme

type SecurityScheme struct {
	marshaller.CoreModel `model:"securityScheme"`

	Type             marshaller.Node[string]                                             `key:"type"`
	Description      marshaller.Node[*string]                                            `key:"description"`
	Name             marshaller.Node[*string]                                            `key:"name"`
	In               marshaller.Node[*string]                                            `key:"in"`
	Flow             marshaller.Node[*string]                                            `key:"flow"`
	AuthorizationURL marshaller.Node[*string]                                            `key:"authorizationUrl"`
	TokenURL         marshaller.Node[*string]                                            `key:"tokenUrl"`
	Scopes           marshaller.Node[*sequencedmap.Map[string, marshaller.Node[string]]] `key:"scopes"`
	Extensions       core.Extensions                                                     `key:"extensions"`
}

SecurityScheme defines a security scheme that can be used by the operations.

type Swagger

type Swagger struct {
	marshaller.CoreModel `model:"swagger"`

	Swagger             marshaller.Node[string]                                                         `key:"swagger" required:"true"`
	Info                marshaller.Node[Info]                                                           `key:"info"`
	Host                marshaller.Node[*string]                                                        `key:"host"`
	BasePath            marshaller.Node[*string]                                                        `key:"basePath"`
	Schemes             marshaller.Node[[]string]                                                       `key:"schemes"`
	Consumes            marshaller.Node[[]string]                                                       `key:"consumes"`
	Produces            marshaller.Node[[]string]                                                       `key:"produces"`
	Paths               marshaller.Node[Paths]                                                          `key:"paths"`
	Definitions         marshaller.Node[*sequencedmap.Map[string, marshaller.Node[oascore.JSONSchema]]] `key:"definitions"`
	Parameters          marshaller.Node[*sequencedmap.Map[string, marshaller.Node[*Parameter]]]         `key:"parameters"`
	Responses           marshaller.Node[*sequencedmap.Map[string, marshaller.Node[*Response]]]          `key:"responses"`
	SecurityDefinitions marshaller.Node[*sequencedmap.Map[string, marshaller.Node[*SecurityScheme]]]    `key:"securityDefinitions"`
	Security            marshaller.Node[[]marshaller.Node[*SecurityRequirement]]                        `key:"security"`
	Tags                marshaller.Node[[]marshaller.Node[*Tag]]                                        `key:"tags"`
	ExternalDocs        marshaller.Node[*ExternalDocumentation]                                         `key:"externalDocs"`
	Extensions          core.Extensions                                                                 `key:"extensions"`
}

Swagger is the root document object for the API specification (Swagger 2.0).

type Tag

type Tag struct {
	marshaller.CoreModel `model:"tag"`

	Name         marshaller.Node[string]                 `key:"name"`
	Description  marshaller.Node[*string]                `key:"description"`
	ExternalDocs marshaller.Node[*ExternalDocumentation] `key:"externalDocs"`
	Extensions   core.Extensions                         `key:"extensions"`
}

Tag allows adding metadata to a single tag that is used by operations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL