openapi

package
v0.386.0-next.3 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const OpenApiSpecificationVersion = "3.1.0"

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentsObject

type ComponentsObject struct {
	Schemas map[string]jsonschema.JSONSchema `json:"schemas,omitempty"`
}

type InfoObject

type InfoObject struct {
	Title   string `json:"title"`
	Version string `json:"version"`
}

type MediaTypeObject

type MediaTypeObject struct {
	Schema jsonschema.JSONSchema `json:"schema,omitempty"`
}

type OpenAPI

type OpenAPI struct {
	OpenAPI    string                    `json:"openapi"`
	Info       InfoObject                `json:"info"`
	Paths      map[string]PathItemObject `json:"paths,omitempty"`
	Components *ComponentsObject         `json:"components,omitempty"`
}

OpenAPI spec object - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md

func Generate

func Generate(ctx context.Context, schema *proto.Schema, api *proto.Api) OpenAPI

Generate creates an OpenAPI 3.1 spec for the passed api.

func GenerateJob

func GenerateJob(ctx context.Context, schema *proto.Schema, jobName string) OpenAPI

type OperationObject

type OperationObject struct {
	OperationID *string                   `json:"operationId,omitempty"`
	RequestBody *RequestBodyObject        `json:"requestBody,omitempty"`
	Responses   map[string]ResponseObject `json:"responses,omitempty"`
}

type PathItemObject

type PathItemObject struct {
	Post *OperationObject `json:"post,omitempty"`
	Get  *OperationObject `json:"get,omitempty"`
}

type RequestBodyObject

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

type ResponseObject

type ResponseObject struct {
	Description string                     `json:"description"`
	Content     map[string]MediaTypeObject `json:"content,omitempty"`
}

Jump to

Keyboard shortcuts

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