Documentation
¶
Index ¶
- func LoadAllSchemas(entryFiles []string) (map[string]*Schema, error)
- type Extensions
- type GoTypeImport
- type NamedSchema
- type Schema
- func (s *Schema) Extensions() (*Extensions, error)
- func (s *Schema) GetImportExtension() (path, name string, exists bool)
- func (s *Schema) HasProperties() bool
- func (s *Schema) IsObject() bool
- func (s *Schema) IsPropertyRequired(propName string) bool
- func (s *Schema) Items() *Schema
- func (s *Schema) Location() string
- func (s *Schema) OrderedDefinitions() iter.Seq[NamedSchema]
- func (s *Schema) OrderedProperties() iter.Seq2[string, *Schema]
- func (s *Schema) Properties() map[string]*Schema
- func (s *Schema) Ref() string
- func (s *Schema) RefSchema() *Schema
- func (s *Schema) Required() []string
- func (s *Schema) Type() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Extensions ¶
type Extensions struct {
GoType *string `json:"x-go-type"`
GoTypeImport *GoTypeImport `json:"x-go-type-import"`
GoName *string `json:"x-go-name"`
GoTypeName *string `json:"x-go-type-name"`
}
type GoTypeImport ¶
type NamedSchema ¶ added in v0.2.0
NamedSchema is a reusable schema declared in $defs or definitions.
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
Schema represents a JSON Schema in a language-agnostic way.
func LoadSchema ¶
LoadSchema loads a JSON or YAML schema file and parses it into a *Schema model.
func (*Schema) Extensions ¶
func (s *Schema) Extensions() (*Extensions, error)
func (*Schema) GetImportExtension ¶
GetImportExtension retrieves import information from x-go-type-import extension. Returns path and name if the extension exists and is properly formatted.
func (*Schema) HasProperties ¶
HasProperties returns true if the schema has properties (is an object with properties).
func (*Schema) IsPropertyRequired ¶
IsPropertyRequired returns true if a property is required.
func (*Schema) OrderedDefinitions ¶ added in v0.2.0
func (s *Schema) OrderedDefinitions() iter.Seq[NamedSchema]
OrderedDefinitions returns the schema definitions sorted by name and reference.
func (*Schema) Properties ¶
Properties returns the schema properties.
Click to show internal directories.
Click to hide internal directories.