model

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	StyleForm           = "form"
	StyleSimple         = "simple"
	StyleDeepObject     = "deepObject"
	StyleSpaceDelimited = "spaceDelimited"
	StylePipeDelimited  = "pipeDelimited"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Example

type Example struct {
	Name       string
	Summary    string
	Value      any
	Source     ExampleSource
	HasValue   bool
	Serialized bool
}

type ExampleSource

type ExampleSource string
const (
	ExampleFromExplicit ExampleSource = "explicit"
	ExampleFromDefault  ExampleSource = "default"
	ExampleFromEnum     ExampleSource = "enum"
	ExampleFromSchema   ExampleSource = "schema"
)

type HTTPMethod

type HTTPMethod string
const (
	MethodGet     HTTPMethod = "GET"
	MethodPost    HTTPMethod = "POST"
	MethodPut     HTTPMethod = "PUT"
	MethodPatch   HTTPMethod = "PATCH"
	MethodDelete  HTTPMethod = "DELETE"
	MethodHead    HTTPMethod = "HEAD"
	MethodOptions HTTPMethod = "OPTIONS"
	MethodTrace   HTTPMethod = "TRACE"
	MethodQuery   HTTPMethod = "QUERY"
)
type Header struct {
	Name        string
	Description string
	Example     Example
	Schema      *SchemaRef
}

type MediaType

type MediaType struct {
	ContentType string
	Examples    []Example
	Schema      *SchemaRef
}

type OAuthFlow

type OAuthFlow struct {
	Type             OAuthFlowType
	AuthorizationURL string
	TokenURL         string
	RefreshURL       string
	Scopes           []string
}

type OAuthFlowType

type OAuthFlowType string
const (
	OAuthFlowAuthorizationCode OAuthFlowType = "authorizationCode"
	OAuthFlowImplicit          OAuthFlowType = "implicit"
	OAuthFlowPassword          OAuthFlowType = "password"
	OAuthFlowClientCredentials OAuthFlowType = "clientCredentials"
)

type Operation

type Operation struct {
	ID          string
	Method      HTTPMethod
	Path        string
	Summary     string
	Description string
	Tags        []string
	Deprecated  bool
	Servers     []Server
	Parameters  []Parameter
	RequestBody *RequestBody
	Responses   []Response
	Security    []SecurityRequirement
}

type Parameter

type Parameter struct {
	Name        string
	Location    ParameterLocation
	Description string
	Required    bool
	Style       string
	Explode     *bool
	Example     Example
	Schema      *SchemaRef
}

type ParameterLocation

type ParameterLocation string
const (
	InPath   ParameterLocation = "path"
	InQuery  ParameterLocation = "query"
	InHeader ParameterLocation = "header"
	InCookie ParameterLocation = "cookie"
)

type RequestBody

type RequestBody struct {
	Description string
	Required    bool
	MediaTypes  []MediaType
}

type Response

type Response struct {
	StatusCode  string
	Description string
	Headers     []Header
	MediaTypes  []MediaType
}

type Schema added in v0.23.5

type Schema struct {
	Title                string
	Description          string
	Types                []SchemaType
	Format               string
	Pattern              string
	Example              any
	HasExample           bool
	Default              any
	HasDefault           bool
	Enum                 []any
	Min                  *float64
	Max                  *float64
	MinLen               *int64
	MaxLen               *int64
	Required             []string
	Nullable             *bool
	ReadOnly             *bool
	WriteOnly            *bool
	Items                *SchemaRef
	Properties           map[string]*SchemaRef
	AdditionalProperties *SchemaRef
	OneOf                []*SchemaRef
	AnyOf                []*SchemaRef
	AllOf                []*SchemaRef
}

func (*Schema) DefaultValue added in v0.47.1

func (s *Schema) DefaultValue() (any, bool)

func (*Schema) ExampleValue added in v0.47.1

func (s *Schema) ExampleValue() (any, bool)

type SchemaRef

type SchemaRef struct {
	Identifier string
	Node       *Schema
}

type SchemaType added in v0.23.6

type SchemaType string
const (
	TypeString  SchemaType = "string"
	TypeInteger SchemaType = "integer"
	TypeNumber  SchemaType = "number"
	TypeBoolean SchemaType = "boolean"
	TypeArray   SchemaType = "array"
	TypeObject  SchemaType = "object"
	TypeNull    SchemaType = "null"
)

func SchemaTypesFromStrings added in v0.23.6

func SchemaTypesFromStrings(src []string) []SchemaType

SchemaTypesFromStrings normalizes supported OpenAPI schema type names.

type SchemaTypeInfo added in v0.23.6

type SchemaTypeInfo struct {
	PrimaryType SchemaType
	Nullable    bool
	Explicit    bool
}

PrimaryType is the first concrete (non-null) type when one is declared, TypeNull for null-only schemas, and the caller's default otherwise.

func InferSchemaType added in v0.23.6

func InferSchemaType(sch *Schema, d SchemaType) SchemaTypeInfo

type SecurityRequirement

type SecurityRequirement struct {
	SchemeName string
	Scopes     []string
}

type SecurityScheme

type SecurityScheme struct {
	Type         SecuritySchemeType
	Subtype      string
	Name         string
	In           ParameterLocation
	Description  string
	BearerFormat string
	OAuthFlows   []OAuthFlow
}

type SecuritySchemeType

type SecuritySchemeType string
const (
	SecurityHTTP   SecuritySchemeType = "http"
	SecurityAPIKey SecuritySchemeType = "apiKey"
	SecurityOAuth2 SecuritySchemeType = "oauth2"
	SecurityOpenID SecuritySchemeType = "openIdConnect"
)

type Server

type Server struct {
	URL         string
	Description string
}

type Spec

type Spec struct {
	Title           string
	Version         string
	Description     string
	Servers         []Server
	Operations      []Operation
	SecuritySchemes map[string]SecurityScheme
}

Jump to

Keyboard shortcuts

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