openapi

package
v0.0.0-...-21fe71f Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package openapi provides parses OpenAPI definitions and passes them to the transpiler.

Index

Constants

View Source
const (
	TokenName            = "name"
	TokenIn              = "in"
	TokenAllowEmptyValue = "allowEmptyValue"
)

The following tokens are OpenAPI Specification Header Object field names. See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#headerObject

View Source
const (
	TokenTags        = "tags"
	TokenSummary     = "summary"
	TokenOperationID = "operationId"
	TokenParameters  = "parameters"
	TokenRequestBody = "requestBody"
	TokenResponses   = "responses"
	TokenCallbacks   = "callbacks"
	TokenSecurity    = "security"
	TokenServers     = "servers"
)

The following tokens are OpenAPI Specification Operation Object field names. See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operation-object

View Source
const (
	TokenStyle         = "style"
	TokenExplode       = "explode"
	TokenAllowReserved = "allowReserved"
	TokenSchema        = "schema"
	TokenExamples      = "examples"
	TokenContent       = "content"
)

The following tokens are OpenAPI Specification Paramerter Object field names. See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameter-object

View Source
const (
	TokenTitle            = "title"
	TokenMultipleOf       = "multipleOf"
	TokenMaximum          = "maximum"
	TokenExclusiveMaximum = "exclusiveMaximum"
	TokenMinimum          = "minimum"
	TokenExclusiveMinimum = "exclusiveMinimum"
	TokenMaxLength        = "maxLength"
	TokenMinLength        = "minLength"
	TokenPattern          = "pattern"
	TokenMaxItems         = "maxItems"
	TokenMinItems         = "minItems"
	TokenUniqueItems      = "uniqueItems"
	TokenMaxProperties    = "maxProperties"
	TokenMinProperties    = "minProperties"
	TokenRequired         = "required"
	TokenEnum             = "enum"
)

The following tokens are taken directly from the JSON Schema definition. See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schema-object

View Source
const (
	TokenType                 = "type"
	TokenAllOf                = "allOf"
	TokenOneOf                = "oneOf"
	TokenAnyOf                = "anyOf"
	TokenNot                  = "not"
	TokenItems                = "items"
	TokenProperties           = "properties"
	TokenAdditionalProperties = "additionalProperties"
	TokenDescription          = "description"
	TokenFormat               = "format"
	TokenDefault              = "default"
)

The following tokens are taken from the JSON Schema definition but their definitions were adjusted to the OpenAPI Specification. See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schema-object

View Source
const (
	TokenNullable      = "nullable"
	TokenDiscriminator = "discriminator"
	TokenReadOnly      = "readOnly"
	TokenWriteOnly     = "writeOnly"
	TokenXml           = "xml"
	TokenExternalDocs  = "externalDocs"
	TokenExample       = "example"
	TokenDeprecated    = "deprecated"
)

The following tokens are JSON Schema subset fields, definitions from the OpenAPI Specification. See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schema-object

View Source
const (
	TokenEncoding = "encoding"
)

The following tokens are OpenAPI Specification MediaType Object field names. See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#mediaTypeObject

View Source
const (
	TokenRef = "$ref"
)

The following tokens are OpenAPI Specification Reference Object field names. See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#referenceObject

Variables

This section is empty.

Functions

This section is empty.

Types

type Extension

type Extension struct {
	Extend string            `json:"extend" yaml:"extend"`
	Fields []*ExtensionField `json:"fields" yaml:"fields"`
}

Extension represents a Protocol Buffers extension from within OpenAPI spec.

The key name must be "x-extension".

type ExtensionField

type ExtensionField struct {
	Name   string `yaml:"name" json:"name"`
	Type   string `yaml:"type" json:"type"`
	Number int    `yaml:"number" json:"number"`
}

ExtensionField defines the field to be added to the extend message type.

type RootOption

type RootOption openapi3.ExtensionProps

RootOption represents a Protocol Buffers root options.

type Schema

type Schema struct {
	*openapi3.T
}

Schema represents a root of an OpenAPI v3 document.

func LoadFile

func LoadFile(ctx context.Context, f string) (*Schema, error)

LoadFile loads f OpenAPI file and returns the new *Schema.

Jump to

Keyboard shortcuts

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