modulepackage
0.0.0-20240619113810-c62c58bb3428
Repository: https://github.com/nasa9084/go-openapi.git
Documentation: pkg.go.dev
# README
OpenAPI Specification object model
This package is still under development, so the API will be changed without any notification
Overview
This is an implementation of OpenAPI Specification 3.0 object model with some usable functions.
Synopsis
package main
import (
"fmt"
"github.com/nasa9084/go-openapi"
)
func main() {
doc, _ := openapi.LoadFile("path/to/spec")
fmt.Print(doc.Version)
}
Status
- Model definition
- Load OpenAPI 3.0 spec file
- Resolve Reference object
- Resolve #/component reference
- Resolve other file reference
- Validation
- Validate spec values
- test for validation
- Document
- Info
- Contact
- License
- Server
- ServerVariable
- Paths
- PathItem
- Operation
- Parameter
- RequestBody
- Responses
- Response
- Callbacks
- Callback
- Schema
- Example
- MediaType
- Header
- Link
- Encoding
- Discriminator
- XML
- Components
- SecurityScheme
- OAuthFlows
- OAuthFlow
- SecurityRequirement
- Tag
- ExternalDocumentation
- test for validation
- Validate HTTP Request
- Validate HTTP Response
- Validate spec values
# Packages
No description provided by the author
# Functions
Load OpenAPI Specification v3.0 spec.
LoadFile OpenAPI Specification v3.0 spec file.
ResolveCallback resolves a callback reference string.
ResolveExample resolves an example reference string.
ResolveHeader resolves a header reference string.
ResolveLink resolves a link reference string.
ResolveParameter resolves a response reference string.
ResolveRequestBody resolves a requestBody reference string.
ResolveResponse resolves a response reference string.
ResolveSchema resolves a schema reference string.
ResolveSecurityScheme resolves a securityScheme reference string.
# Constants
SecuritySchemeTypes.
ErrAllowEmptyValueNotValid is returned when allowEmptyValue is specified but parameter.in is not query.
ErrInvalidFlowType is returned when the OAuth flow type is invalid or not set to the object.
ErrInvalidStatusCode is returned when specified status code is not valid as HTTP status code.
ErrMissingRootDocument is returned when validating securityRequirement object but root document is not set.
ErrRequiredMustTrue is returned when the value of parameter.required is false when parameter.in is path.
ErrUnsupportedVersion is returned when the openapi version is unsupported by this package.
SecuritySchemeTypes.
InTypes.
InTypes.
InTypes.
InTypes.
SecuritySchemeTypes.
SecuritySchemeTypes.
# Variables
central error variables relating format.
ErrOperationIDDuplicated is returned when some operation ids are duplicated but operation ids cannot be duplicated.
ErrParameterDuplicated is returned when some parameters are duplicated but cannot be duplicated.
central error variables relating format.
ErrPathsDuplicated is returned when some paths are duplicated.
central error variables relating format.
ErrTooManyHeaderContent is returned when the length of header.content is more than 2.
ErrTooManyParameterContent is returned when the length of parameter.content is more than 2.
ErrTypeAssertion is raised when the type assertion error is occurred.
InType Lists for ErrOneOf.
InType Lists for ErrOneOf.
SecuritySchemeTypeList is a list of valid values of securityScheme.Type.
# Structs
Components Object.
Contact Object.
Discriminator Object.
Document represents a OpenAPI Specification document.
Encoding Object.
ErrFormatInvalid is returned some error caused by string format is occurred.
ErrMustEmpty returned when the securityRequirement is not empty but must be empty.
ErrMustOneOf is returned some value must be one of given list, but not one.
ErrNotDeclared is returned when the securityScheme name is not defined in components object in the document.
ErrRequired is returned when missing some required parameter.
Example Object.
ExternalDocumentation Object.
Header Object.
Info Object.
License Object.
Link Object.
MediaType Object.
OAuthFlow Object.
OAuthFlows Object.
Operation Object.
Parameter Object.
PathItem Object.
RequestBody Object.
Response Object.
Schema Object.
SecurityRequirement Object.
SecurityScheme Object.
Server Object.
ServerVariable Object.
Tag Object.
XML Object.