openapi

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Components added in v1.26.0

type Components struct {
	Schemas         map[string]*jsonschema.Schema `json:"schemas,omitzero"`
	SecuritySchemes map[string]*SecurityScheme    `json:"securitySchemes,omitzero"`
}

Components holds a set of reusable objects for different aspects of the OpenAPI schema. https://spec.openapis.org/oas/v3.1.0#components-object

type Doc added in v1.26.0

type Doc struct {
	OpenAPI    string                           `json:"openapi"`
	Info       Info                             `json:"info"`
	Servers    []*Server                        `json:"servers,omitzero"`
	Paths      map[string]map[string]*Operation `json:"paths,omitzero"`
	Components *Components                      `json:"components,omitzero"`
}

Doc is the root object of the OpenAPI document. https://spec.openapis.org/oas/v3.1.0#openapi-object

type Endpoint

type Endpoint struct {
	Type           string
	Name           string
	Route          string
	Summary        string
	Description    string
	InputArgs      any
	OutputArgs     any
	Method         string
	RequiredClaims string
}

Endpoint describes a single endpoint of a microservice, such as an RPC function.

type Info added in v1.26.0

type Info struct {
	Title       string `json:"title"`
	Description string `json:"description,omitzero"`
	Version     string `json:"version,omitzero"`
}

Info provides metadata about the API. https://spec.openapis.org/oas/v3.1.0#info-object

type MediaType added in v1.26.0

type MediaType struct {
	Description string             `json:"description,omitzero"`
	Schema      *jsonschema.Schema `json:"schema,omitzero"`
}

MediaType provides schema and examples for the media type identified by its key. https://spec.openapis.org/oas/v3.1.0#media-type-object

type Operation added in v1.26.0

type Operation struct {
	Summary      string                 `json:"summary"`
	Description  string                 `json:"description,omitzero"`
	XFeatureType string                 `json:"x-feature-type,omitzero"`
	Parameters   []*Parameter           `json:"parameters,omitzero"`
	RequestBody  *RequestBody           `json:"requestBody,omitzero"`
	Responses    map[string]*Response   `json:"responses,omitzero"`
	Security     []*SecurityRequirement `json:"security,omitzero"`
}

Operation describes a single API operation on a path. https://spec.openapis.org/oas/v3.1.0#operation-object

type Parameter added in v1.26.0

type Parameter struct {
	Name        string             `json:"name"`
	In          string             `json:"in"`
	Description string             `json:"description,omitzero"`
	Schema      *jsonschema.Schema `json:"schema,omitzero"`
	Style       string             `json:"style,omitzero"`
	Explode     bool               `json:"explode,omitzero"`
	Required    bool               `json:"required,omitzero"`
}

Parameter describes a single operation parameter. https://spec.openapis.org/oas/v3.1.0#parameter-object

type RequestBody added in v1.26.0

type RequestBody struct {
	Description string                `json:"description,omitzero"`
	Required    bool                  `json:"required,omitzero"`
	Content     map[string]*MediaType `json:"content,omitzero"`
}

RequestBody describes a single request body. https://spec.openapis.org/oas/v3.1.0#request-body-object

type Response added in v1.26.0

type Response struct {
	Description string                `json:"description,omitzero"`
	Content     map[string]*MediaType `json:"content,omitzero"`
}

Response describes a single response from an API Operation. https://spec.openapis.org/oas/v3.1.0#response-object

type SecurityRequirement added in v1.26.0

type SecurityRequirement map[string][]string

SecurityRequirement specifies a security scheme required to access an API Operation. https://spec.openapis.org/oas/v3.1.0#security-requirement-object

type SecurityScheme added in v1.26.0

type SecurityScheme struct {
	Type         string `json:"type,omitzero"`
	Description  string `json:"description,omitzero"`
	Scheme       string `json:"scheme,omitzero"`
	BearerFormat string `json:"bearerFormat,omitzero"`
}

SecurityScheme describes means of authentication. https://spec.openapis.org/oas/v3.1.0#security-scheme-object

type Server added in v1.26.0

type Server struct {
	URL         string `json:"url"`
	Description string `json:"description,omitzero"`
}

Server represents a server. https://spec.openapis.org/oas/v3.1.0#server-object

type Service

type Service struct {
	ServiceName string
	Description string
	Version     int
	Endpoints   []*Endpoint
	RemoteURI   string
}

Service is populated with the microservice's specs in order to generate its OpenAPI document.

func (*Service) MarshalJSON

func (s *Service) MarshalJSON() ([]byte, error)

MarshalJSON produces the JSON representation of the OpenAPI document of the service.

Jump to

Keyboard shortcuts

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