Documentation ¶
Index ¶
Constants ¶
const ( //TypeNameObject represents an object TypeNameObject propertyTypeName = iota //object //TypeNameString represents an string TypeNameString //string //TypeNameBool represents an boolean TypeNameBool //boolean //TypeNameInteger represents an integer TypeNameInteger //integer //TypeNameNumber represents a number (float or integer) TypeNameNumber //number //TypeNameArray represents and object TypeNameArray //array )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CodeGenerator ¶
type CodeGenerator struct {
// contains filtered or unexported fields
}
CodeGenerator creates following struct methods
`IsSet() bool` `Reset()` `validate() error` `validate() error` `processNestedSource() error`
on all exported and anonymous structs that are referenced by at least one of the root types
func NewCodeGenerator ¶
func NewCodeGenerator(parsed *Parsed, rootTypes []string) (*CodeGenerator, error)
NewCodeGenerator takes an importPath and the package name for which the type definitions should be loaded. The nullableTypePath is used to implement validation rules specific to types of the nullable package. The generator creates methods only for types referenced directly or indirectly by any of the root types.
type JSONSchemaGenerator ¶
type JSONSchemaGenerator struct {
// contains filtered or unexported fields
}
JSONSchemaGenerator holds the parsed package information from which it can generate a JSON schema
func NewJSONSchemaGenerator ¶
func NewJSONSchemaGenerator(parsed *Parsed) (*JSONSchemaGenerator, error)
NewJSONSchemaGenerator takes a parsed package information as input parameter and returns a JSONSchemaGenerator instance
type Parsed ¶
type Parsed struct { // Dir holds the filesystem directory holding the parsed Go package. Dir string // contains filtered or unexported fields }
Parsed contains information about a parsed package, including the package name, type information and some pre-defined variables