Documentation
¶
Index ¶
- func NamedSchema(title string, schema *jsonschema.Schema) *jsonschema.Schema
- func Operation(summary string, opts ...OperationOpt) schema.Operation
- func Operations(pathitem *schema.PathItem, fn func(method string, op *schema.Operation))
- type MarkdownDoc
- type OperationOpt
- func WithDeprecated() OperationOpt
- func WithDescription(description string) OperationOpt
- func WithErrorResponse(status int, description ...string) OperationOpt
- func WithFormRequest(schemas ...*jsonschema.Schema) OperationOpt
- func WithID(id string) OperationOpt
- func WithJSONRequest(schemas ...*jsonschema.Schema) OperationOpt
- func WithJSONResponse(status int, r *jsonschema.Schema) OperationOpt
- func WithMultipartRequest(schemas ...*jsonschema.Schema) OperationOpt
- func WithNamedFormRequest(title string, schemas ...*jsonschema.Schema) OperationOpt
- func WithNamedJSONRequest(title string, schemas ...*jsonschema.Schema) OperationOpt
- func WithNamedMultipartRequest(title string, schemas ...*jsonschema.Schema) OperationOpt
- func WithNamedRequest(contentType, title string, schemas ...*jsonschema.Schema) OperationOpt
- func WithNoContentResponse(status int, description ...string) OperationOpt
- func WithQuery(q *jsonschema.Schema) OperationOpt
- func WithRequest(contentType string, schemas ...*jsonschema.Schema) OperationOpt
- func WithResponse(status int, contentType string, r *jsonschema.Schema, description ...string) OperationOpt
- func WithSecurity(schemeName string, enabled bool, scopes ...string) OperationOpt
- func WithTags(tags ...string) OperationOpt
- func WithTextResponse(status int, description string) OperationOpt
- func WithTextStreamResponse(status int, description ...string) OperationOpt
- type Section
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NamedSchema ¶ added in v1.6.25
func NamedSchema(title string, schema *jsonschema.Schema) *jsonschema.Schema
NamedSchema clones a schema and applies a title to the clone.
Types ¶
type MarkdownDoc ¶ added in v1.6.25
type MarkdownDoc struct {
// contains filtered or unexported fields
}
func ParseMarkdown ¶ added in v1.6.25
func ParseMarkdown(data []byte) (doc *MarkdownDoc)
func (*MarkdownDoc) FindSection ¶ added in v1.6.25
func (doc *MarkdownDoc) FindSection(title string) *markdown.Heading
FindSection returns the first heading whose text matches title.
func (*MarkdownDoc) Section ¶ added in v1.6.25
func (doc *MarkdownDoc) Section(level int, title string) Section
func (*MarkdownDoc) Sections ¶ added in v1.6.25
func (doc *MarkdownDoc) Sections() []Section
type OperationOpt ¶
type OperationOpt func(*opopt)
OperationOpt applies a configuration change to an OpenAPI operation.
func WithDeprecated ¶
func WithDeprecated() OperationOpt
WithDeprecated marks the operation as deprecated.
func WithDescription ¶
func WithDescription(description string) OperationOpt
WithDescription sets the operation description.
func WithErrorResponse ¶
func WithErrorResponse(status int, description ...string) OperationOpt
WithErrorResponse sets a JSON error response using httpresponse.ErrResponse.
func WithFormRequest ¶
func WithFormRequest(schemas ...*jsonschema.Schema) OperationOpt
WithFormRequest sets the form-encoded request body schema.
func WithJSONRequest ¶
func WithJSONRequest(schemas ...*jsonschema.Schema) OperationOpt
WithJSONRequest sets the JSON request body schema.
func WithJSONResponse ¶
func WithJSONResponse(status int, r *jsonschema.Schema) OperationOpt
WithJSONResponse sets the JSON response schema for a status code.
func WithMultipartRequest ¶
func WithMultipartRequest(schemas ...*jsonschema.Schema) OperationOpt
WithMultipartRequest sets the multipart form request body schema.
func WithNamedFormRequest ¶ added in v1.6.25
func WithNamedFormRequest(title string, schemas ...*jsonschema.Schema) OperationOpt
WithNamedFormRequest sets a titled form-encoded request body schema.
func WithNamedJSONRequest ¶ added in v1.6.25
func WithNamedJSONRequest(title string, schemas ...*jsonschema.Schema) OperationOpt
WithNamedJSONRequest sets a titled JSON request body schema.
func WithNamedMultipartRequest ¶ added in v1.6.25
func WithNamedMultipartRequest(title string, schemas ...*jsonschema.Schema) OperationOpt
WithNamedMultipartRequest sets a titled multipart form request body schema.
func WithNamedRequest ¶ added in v1.6.25
func WithNamedRequest(contentType, title string, schemas ...*jsonschema.Schema) OperationOpt
WithNamedRequest sets the request body schema for a specific content type and applies a title to the generated wrapper schema.
When more than one schema is provided, they are wrapped in a titled `oneOf` schema.
func WithNoContentResponse ¶ added in v1.6.21
func WithNoContentResponse(status int, description ...string) OperationOpt
WithNoContentResponse sets a response with no body for a status code.
func WithQuery ¶
func WithQuery(q *jsonschema.Schema) OperationOpt
WithQuery adds query parameters inferred from a JSON schema.
func WithRequest ¶
func WithRequest(contentType string, schemas ...*jsonschema.Schema) OperationOpt
WithRequest sets the request body schema for a specific content type.
When more than one schema is provided, they are wrapped in a `oneOf` schema.
func WithResponse ¶
func WithResponse(status int, contentType string, r *jsonschema.Schema, description ...string) OperationOpt
WithResponse sets the response schema for a status code and content type.
func WithSecurity ¶
func WithSecurity(schemeName string, enabled bool, scopes ...string) OperationOpt
WithSecurity adds a security requirement to the operation.
func WithTextResponse ¶
func WithTextResponse(status int, description string) OperationOpt
WithTextResponse sets a plain-text response for a status code.
func WithTextStreamResponse ¶ added in v1.6.21
func WithTextStreamResponse(status int, description ...string) OperationOpt
WithTextStreamResponse sets a text/event-stream style response for a status code.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package httphandler provides HTTP handler functions for an httprouter.Router.
|
Package httphandler provides HTTP handler functions for an httprouter.Router. |
|
Package schema provides Go types for the OpenAPI 3.1 specification.
|
Package schema provides Go types for the OpenAPI 3.1 specification. |
|
Package static contains embedded static files for the OpenAPI handler.
|
Package static contains embedded static files for the OpenAPI handler. |