oapi_builder

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HandlersWithSchemas

type HandlersWithSchemas struct {
	MainInfoSchemas   Schemer
	PathSchemas       []Schemer
	ComponentsSchemas []Schemer
}

type OapiBuilder

type OapiBuilder struct {
	// contains filtered or unexported fields
}

func New

func New(logger *slog.Logger) *OapiBuilder

func (*OapiBuilder) AddComponentsSchemas

func (ob *OapiBuilder) AddComponentsSchemas(schemers []Schemer) *OapiBuilder

Example:

User:
	...
Error:
	...

func (*OapiBuilder) AddMainInfo

func (ob *OapiBuilder) AddMainInfo(schemer Schemer) *OapiBuilder

Example:

openapi: 3.0.0
info:
	...
tags:
	...
servers:
	...

func (*OapiBuilder) AddPaths

func (ob *OapiBuilder) AddPaths(schemers []Schemer) *OapiBuilder

Example:

  /api/v1/users:
    get:
		...
  /api/v1/users/{id}:
	put:
		...

AddPaths добавляет пути в спецификацию Сюда приходят схемы, в каждой из которых указан путь Мы вычисляем, какие пути уже есть и удаляем их из схем

func (*OapiBuilder) GetOapiInBytes

func (ob *OapiBuilder) GetOapiInBytes() []byte

func (*OapiBuilder) MustGenerateSchemas

func (ob *OapiBuilder) MustGenerateSchemas(hws HandlersWithSchemas, saveTo string) *OapiBuilder

MustGenerateSchemas generate oapi specification and save to file as GenerateSchemas

Make panic if error

func (*OapiBuilder) PasteWithIndent

func (ob *OapiBuilder) PasteWithIndent(textWithNewLines string, deepLevel int) *OapiBuilder

func (*OapiBuilder) String

func (ob *OapiBuilder) String() string

func (*OapiBuilder) ValidateAndGenerateYaml

func (ob *OapiBuilder) ValidateAndGenerateYaml(path string) (string, error)

type Schemer

type Schemer interface {
	Scheme() string
}

Jump to

Keyboard shortcuts

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