xjtd

package
v0.0.0-...-ed0136c Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const GoPackageName = "generated"

Variables

This section is empty.

Functions

func NewSerializableMapSchema

func NewSerializableMapSchema(schema map[string]jtd.Schema) map[string]SerializableSchema

Types

type GenerateSchemaResult

type GenerateSchemaResult struct {
	RootName        string            `json:"root_name"`
	DefinitionNames map[string]string `json:"definition_names"`
}

func GenerateSchema

func GenerateSchema(ctx context.Context, file string, name string, schema jtd.Schema, externalDefinitions []string) (GenerateSchemaResult, error)

type SerializableSchema

type SerializableSchema struct {
	Definitions          map[string]SerializableSchema `json:"definitions,omitempty"`
	Metadata             map[string]interface{}        `json:"metadata,omitempty"`
	Nullable             bool                          `json:"nullable,omitempty"`
	Ref                  *string                       `json:"ref,omitempty"`
	Type                 string                        `json:"type,omitempty"`
	Enum                 []string                      `json:"enum,omitempty"`
	Elements             *SerializableSchema           `json:"elements,omitempty"`
	Properties           map[string]SerializableSchema `json:"properties,omitempty"`
	OptionalProperties   map[string]SerializableSchema `json:"optionalProperties,omitempty"`
	AdditionalProperties bool                          `json:"additionalProperties,omitempty"`
	Values               *SerializableSchema           `json:"values,omitempty"`
	Discriminator        string                        `json:"discriminator,omitempty"`
	Mapping              map[string]SerializableSchema `json:"mapping,omitempty"`
}

SerializableSchema is a jtd.Schema with omitempty tags. Without those tags, the marshaled schema is invalid according to jtd-codegen.

func NewSerializableSchema

func NewSerializableSchema(schema jtd.Schema) SerializableSchema

func NewSerializableSchemaPointer

func NewSerializableSchemaPointer(schema *jtd.Schema) *SerializableSchema

Jump to

Keyboard shortcuts

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