ogen

package module
v0.0.0-...-a00536e Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: MIT Imports: 2 Imported by: 0

README

ogen

WIP Opionated OpenAPI v3 Code Generator for Go

On early stages of development.

Telegram group for development: @ogen_dev

Documentation

Overview

Package ogen implements OpenAPI v3 code generation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentSchema

type ComponentSchema struct {
	Description string                     `json:"description"`
	Type        string                     `json:"type"`
	Format      string                     `json:"format"`
	Properties  map[string]ComponentSchema `json:"properties"`
	Items       *ComponentSchema           `json:"items"`
	Ref         string                     `json:"$ref"`
}

type Components

type Components struct {
	Schemas map[string]ComponentSchema `json:"schemas"`
}

type Contact

type Contact struct {
	Name  string `json:"name"`
	URL   string `json:"url"`
	Email string `json:"email"`
}

type Content

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

type ContentSchema

type ContentSchema struct {
	Type  string            `json:"type"`
	Items map[string]string `json:"items"`
	Ref   string            `json:"$ref"`
}

type License

type License struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

type Parameter

type Parameter struct {
	Name            string          `json:"name"`
	In              string          `json:"in"`
	Description     string          `json:"description"`
	Schema          ComponentSchema `json:"schema"`
	Required        bool            `json:"required"`         // TODO: implement
	Deprecated      bool            `json:"deprecated"`       // TODO: implement
	AllowEmptyValue bool            `json:" allowEmptyValue"` // TODO: implement
}

type Path

type Path map[string]PathMethod

type PathMethod

type PathMethod struct {
	Description string              `json:"description"`
	OperationID string              `json:"operationId"`
	Parameters  []Parameter         `json:"parameters"`
	RequestBody RequestBody         `json:"requestBody"`
	Responses   map[string]Response `json:"responses"`
}

type RequestBody

type RequestBody struct {
	Description string             `json:"description"`
	Content     map[string]Content `json:"content"`
	Required    bool               `json:"required"` // TODO: implement
}

type Response

type Response struct {
	Description string                 `json:"description"`
	Header      map[string]interface{} // TODO: implement
	Content     map[string]Content     `json:"content"`
	Links       map[string]interface{} // TODO: implement
}

type Server

type Server struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

type Spec

type Spec struct {
	Title          string          `json:"title"`
	Description    string          `json:"description"`
	TermsOfService string          `json:"termsOfService"`
	Contact        *Contact        `json:"contact"`
	License        *License        `json:"license"`
	Version        string          `json:"version"`
	Servers        []Server        `json:"servers"`
	Paths          map[string]Path `json:"paths"`
	Components     *Components     `json:"components"`
}

func Parse

func Parse(r io.Reader) (*Spec, error)

Directories

Path Synopsis
cmd
ogen
Binary ogen generates go source code from TL schema.
Binary ogen generates go source code from TL schema.
internal
gen
Package gen implements code generation.
Package gen implements code generation.

Jump to

Keyboard shortcuts

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