model

package
v0.23.6 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func CloneStrs added in v0.23.5

func CloneStrs(src []string) []string

Types

type Example

type Example struct {
	Summary  string
	Value    any
	Source   ExampleSource
	HasValue 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 MediaType

type MediaType struct {
	ContentType string
	Example     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
	MediaTypes  []MediaType
}

type Schema added in v0.23.5

type Schema struct {
	Title                string
	Description          string
	Types                []SchemaType
	Format               string
	Pattern              string
	Example              any
	Default              any
	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
}

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

type SchemaTypeInfo added in v0.23.6

type SchemaTypeInfo struct {
	PrimaryType SchemaType
	Nullable    bool
	Explicit    bool
}

SchemaTypeInfo captures normalized schema type inference details. PrimaryType is the non-null concrete type when available, TypeNull for null-only schemas, or the caller-provided default when no type could be inferred.

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