Documentation ¶
Index ¶
- type JSONSchemaGenerator
- func (g *JSONSchemaGenerator) Generate() (schema.JSONSchema, error)
- func (g *JSONSchemaGenerator) LogDebug(args ...interface{})
- func (g *JSONSchemaGenerator) LogDebugF(format string, args ...interface{})
- func (g *JSONSchemaGenerator) LogInfo(args ...interface{})
- func (g *JSONSchemaGenerator) LogInfoF(format string, args ...interface{})
- func (g *JSONSchemaGenerator) LogVerbose(args ...interface{})
- func (g *JSONSchemaGenerator) LogVerboseF(format string, args ...interface{})
- func (g *JSONSchemaGenerator) SubGenerate(basePackage, rootType string) (schema.JSONSchema, error)
- type LogLevel
- type Options
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
}
JSONSchemaGenerator is the thing that generates schemas. This should not be created manually, instead use NewJSONSchemaGenerator(...)
func NewJSONSchemaGenerator ¶
func NewJSONSchemaGenerator(basePackage, rootType string, options Options) *JSONSchemaGenerator
NewJSONSchemaGenerator creates an instance of the generator. basePackage is the package where the root schema object lives. rootType is the name of the type/struct ib the basePackage that represents the schema root.
func (*JSONSchemaGenerator) Generate ¶
func (g *JSONSchemaGenerator) Generate() (schema.JSONSchema, error)
Generate is the main function that is used to generate a JSONSchema.
func (*JSONSchemaGenerator) LogDebug ¶
func (g *JSONSchemaGenerator) LogDebug(args ...interface{})
LogDebug writes a debug message to std out
func (*JSONSchemaGenerator) LogDebugF ¶
func (g *JSONSchemaGenerator) LogDebugF(format string, args ...interface{})
LogDebugF writes a debug formatted message to std out
func (*JSONSchemaGenerator) LogInfo ¶
func (g *JSONSchemaGenerator) LogInfo(args ...interface{})
LogInfo writes an info message to std out
func (*JSONSchemaGenerator) LogInfoF ¶
func (g *JSONSchemaGenerator) LogInfoF(format string, args ...interface{})
LogInfoF writes an info formatted message to std out
func (*JSONSchemaGenerator) LogVerbose ¶
func (g *JSONSchemaGenerator) LogVerbose(args ...interface{})
LogVerbose writes a verbose message to std out
func (*JSONSchemaGenerator) LogVerboseF ¶
func (g *JSONSchemaGenerator) LogVerboseF(format string, args ...interface{})
LogVerboseF writes a verbose formatted message to std out
func (*JSONSchemaGenerator) SubGenerate ¶
func (g *JSONSchemaGenerator) SubGenerate(basePackage, rootType string) (schema.JSONSchema, error)
SubGenerate can be used to generate sub schemas after the main root has been generated.
type Options ¶
type Options struct { // SpecVersion is the url of the spec version SpecVersion schema.SpecVersion // IncludeTests will parse test files during generation when set to true or ignore them when false. IncludeTests bool // AutoCreateDefs will automatically create definitions when set to true. If false, schemas will be // included inline unless the 'definition' attribute is set within an @jsonSchema annotation AutoCreateDefs bool // LogLevel sets the verbosity of log statements LogLevel LogLevel // DefinitionPrefix is an optional prefix that will get pre-pended to all definition refs after the definition root. DefinitionPrefix string // SupressXAttrs is a flag ti supress non-standard schema properties like x-* SupressXAttrs bool }
Options holds the configuration options for the schema generator instance
func NewOptions ¶
func NewOptions() Options
NewOptions creates a new options instance with sane defaults.