openapi

package
v0.376.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

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"`
	RequestBody ResponseObject            `json:"requestBody"`
	Responses   map[string]ResponseObject `json:"responses,omitempty"`
}

type PathItemObject

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

type RequestBodyObject

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

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