oas

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(input reflect.Value, tag string) map[string]Schema

Types

type Body

type Body struct {
	Description string                       `json:"description,omitempty"`
	Content     map[string]map[string]Schema `json:"content,omitempty"`
	Required    bool                         `json:"required,omitempty"`
}

type DocInfo

type DocInfo struct {
	Title          string `json:"title"`
	Description    string `json:"description"`
	Version        string `json:"version"`
	TermsOfService string `json:"termsOfService"`
}

type Parameter

type Parameter struct {
	Name        string `json:"name"`
	In          string `json:"in"`
	Description string `json:"description,omitempty"`
	Required    bool   `json:"required,omitempty"`
	Schema      Schema `json:"schema"`
}

type Request

type Request struct {
	RequestComment
	Tags        []string        `json:"tags,omitempty"`
	OperationID string          `json:"operationId"`
	Parameters  []Parameter     `json:"parameters,omitempty"`
	RequestBody *Body           `json:"requestBody,omitempty"`
	Responses   map[string]Body `json:"responses,omitempty"`
}

type RequestComment

type RequestComment struct {
	Summary     string `json:"summary,omitempty"`
	Description string `json:"description,omitempty"`
}

type Schema

type Schema struct {
	Type                 string            `json:"type"`
	Required             []string          `json:"required,omitempty"`
	Description          string            `json:"description,omitempty"`
	Format               string            `json:"format,omitempty"`
	Items                *Schema           `json:"items,omitempty"`
	Properties           map[string]Schema `json:"properties,omitempty"`
	AdditionalProperties *bool             `json:"additionalProperties,omitempty"`
	Example              interface{}       `json:"example,omitempty"`
}

Schema represents an OpenAPI Schema Object

https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#schema-object

type Server

type Server struct {
	Url string `json:"url"`
}

type Spec

type Spec struct {
	Openapi    string                    `json:"openapi"`
	Info       DocInfo                   `json:"info"`
	Servers    []Server                  `json:"servers"`
	Tags       []Tag                     `json:"tags"`
	Paths      map[string]map[string]any `json:"paths"`
	Components struct {
		Schema map[string]Schema `json:"schema"`
	} `json:"components"`
}

func NewSpec

func NewSpec() *Spec

type Tag

type Tag struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

Jump to

Keyboard shortcuts

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