Documentation
¶
Overview ¶
Package schema defines basic OpenAPI schema for RPC
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ContentType ¶
type ContentType struct {
Schema *Type `json:"schema,omitempty" yaml:"schema,omitempty"`
}
type Endpoint ¶
type Endpoint struct {
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
OperationID string `json:"operationId" yaml:"operationId"`
RequestBody Payload `json:"requestBody" yaml:"requestBody"`
Responses struct {
OK Payload `json:"200" yaml:"200"`
BadRequest *Payload `json:"400" yaml:"400"`
InternalError *Payload `json:"500" yaml:"500"`
} `json:"responses" yaml:"responses"`
}
type Option ¶
type Option func(builder *schemaBuilder)
Option configures schema creation.
type Payload ¶
type Payload struct {
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Content struct {
JSON *ContentType `json:"application/json,omitempty" yaml:"application/json,omitempty"`
Plain *ContentType `json:"text/plain,omitempty" yaml:"text/plain,omitempty"`
} `json:"content,omitempty" yaml:"content,omitempty"`
}
type Schema ¶
type Schema struct {
OpenAPI string `json:"openapi" yaml:"openapi"`
Servers []Server `json:"servers,omitempty" yaml:"servers,omitempty"`
Info struct {
Title string `json:"title" yaml:"title"`
Version string `json:"version" yaml:"version"`
} `json:"info" yaml:"info"`
Paths map[string]Path `json:"paths,omitempty" yaml:"paths,omitempty"`
Components struct {
Schemas map[string]*Type `json:"schemas,omitempty" yaml:"schemas,omitempty"`
} `json:"components,omitempty" yaml:"components,omitempty"`
}
Schema represents OpenAPI definition of endpoints.
type Server ¶
type Server struct {
URL string `json:"url,omitempty" yaml:"url,omitempty"`
}
Server represents reference to API server.
type Type ¶
type Type struct {
Type string `json:"type,omitempty" yaml:"type,omitempty"`
Format string `json:"format,omitempty" yaml:"format,omitempty"`
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
Items *Type `json:"items,omitempty" yaml:"items,omitempty"`
Properties map[string]*Type `json:"properties,omitempty" yaml:"properties,omitempty"`
Required []string `json:"required,omitempty" yaml:"required,omitempty"`
Minimum *int64 `json:"minimum,omitempty" yaml:"minimum,omitempty"`
Maximum int64 `json:"maximum,omitempty" yaml:"maximum,omitempty"`
PrefixItems []*Type `json:"prefixItems,omitempty" yaml:"prefixItems,omitempty"`
MinItems int `json:"minItems,omitempty" yaml:"minItems,omitempty"`
MaxItems int `json:"maxItems,omitempty" yaml:"maxItems,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Name string `json:"-" yaml:"-"`
}
Click to show internal directories.
Click to hide internal directories.