generator

package
v0.0.0-...-f95d431 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONSchemaGenerator

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

func NewJSONSchemaGenerator

func NewJSONSchemaGenerator(plugin *protogen.Plugin, cfg *config.Config) *JSONSchemaGenerator

NewJSONSchemaGenerator creates a new instance of the JSONSchemaGenerator struct

func (*JSONSchemaGenerator) Run

func (g *JSONSchemaGenerator) Run() error

Run runs the generator

type Schema

type Schema struct {
	Id          string                     `json:"$id,omitempty"`
	SchemaRef   string                     `json:"$schema,omitempty"`
	Title       string                     `json:"title,omitempty"`
	Description string                     `json:"description,omitempty"`
	Type        string                     `json:"type,omitempty"`
	Properties  map[string]*SchemaProperty `json:"properties,omitempty"`
	Required    []string                   `json:"required,omitempty"`
	Definitions map[string]*Schema         `json:"definitions,omitempty"`
	IsRequired  bool                       `json:"-"`
}

func NewSchema

func NewSchema(id, title, description, schemaType string) *Schema

NewSchema creates a NewSchema struct

func (*Schema) Json

func (s *Schema) Json() []byte

Json serializes the schema into JSON format

type SchemaProperty

type SchemaProperty struct {
	Type        string                     `json:"type,omitempty"`
	Format      string                     `json:"format,omitempty"`
	Description string                     `json:"description,omitempty"`
	Ref         string                     `json:"$ref,omitempty"`
	Enum        []string                   `json:"enum,omitempty"`
	Properties  map[string]*SchemaProperty `json:"properties,omitempty"`
	Required    []string                   `json:"required,omitempty"`
	Items       *SchemaProperty            `json:"items,omitempty"`
	MinItems    int32                      `json:"minItems,omitempty"`
	MinLength   int32                      `json:"minLength,omitempty"`
	MaxLength   int32                      `json:"maxLength,omitempty"`
	Pattern     string                     `json:"pattern,omitempty"`
	IsRequired  bool                       `json:"-"`
	IsRef       bool                       `json:"-"`
}

Jump to

Keyboard shortcuts

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