openapiv3

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package openapiv3 reads OpenAPI 3.0, 3.1 and 3.2 documents into an openapi.Document, with kin-openapi.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(ctx context.Context, data []byte, location *url.URL, read func(u *url.URL) ([]byte, error), log *zerolog.Logger) (*openapi.Document, error)

Load reads data, the OpenAPI 3 document at location, and the files its references name, which read returns. It logs on log, at warn level, what it reads but cannot honor, such as servers with different paths, and each example that doesn't fit its schema: zerolog.Nop silences it. Such an example is converted when the text of each value that breaks it reads as the type its schema asks, such as 12345 for a string, else left out. It fails with openapi.ErrInvalid for a document kin-openapi finds invalid but for its examples, or with a null where an object belongs.

func RequestBodies

func RequestBodies(t *openapi3.T, data []byte, location *url.URL) map[*openapi3.MediaType]map[string]any

RequestBodies returns the schema of each media type of the request body of each operation of t, which kin-openapi read from data, the spec at location, in one document: in JSON Schema 2020-12, as Load gives a document's schemas, each integer and each null as data writes it, and as a request sees it, by openapi.RequestRoots. It keeps what kin-openapi checks of a request that JSON Schema doesn't: a oneOf or an anyOf with a discriminator takes an object by the branch the discriminator names, and, in OpenAPI 3.0, a nullable schema takes null whatever its other keywords say. A media type without a schema has none.

Types

This section is empty.

Jump to

Keyboard shortcuts

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