openapi

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSON

func JSON(spec Spec) ([]byte, error)

Types

type Content

type Content struct {
	Schema Schema `json:"schema"`
}

type Info

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

type Operation

type Operation struct {
	Summary     string              `json:"summary"`
	OperationID string              `json:"operationId"`
	Tags        []string            `json:"tags"`
	Parameters  []Parameter         `json:"parameters,omitempty"`
	RequestBody *RequestBody        `json:"requestBody,omitempty"`
	Responses   map[string]Response `json:"responses"`
}

type Parameter

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

type Path

type Path map[string]Operation

type RequestBody

type RequestBody struct {
	Required bool               `json:"required,omitempty"`
	Content  map[string]Content `json:"content"`
}

type Response

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

type Schema

type Schema struct {
	Type       string            `json:"type,omitempty"`
	Format     string            `json:"format,omitempty"`
	Properties map[string]Schema `json:"properties,omitempty"`
	Items      *Schema           `json:"items,omitempty"`
	Enum       []string          `json:"enum,omitempty"`
	Required   []string          `json:"required,omitempty"`
}

type Spec

type Spec struct {
	OpenAPI string          `json:"openapi"`
	Info    Info            `json:"info"`
	Paths   map[string]Path `json:"paths"`
}

func Generate

func Generate(app *admin.App, version string) Spec

Jump to

Keyboard shortcuts

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