Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flexible AdditionalProperties #65

Merged
merged 1 commit into from
Apr 26, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions spec/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,22 @@ var supportedSchemaFields = []string{
}

type Schema struct {
AdditionalProperties bool `json:"additionalProperties,omitempty" yaml:"additionalProperties"`
AnyOf []*Schema `json:"anyOf,omitempty" yaml:"anyOf"`
Enum []interface{} `json:"enum,omitempty" yaml:"enum"`
Items *Schema `json:"items,omitempty" yaml:"items"`
Nullable bool `json:"nullable,omitempty" yaml:"nullable"`
Pattern string `json:"pattern,omitempty" yaml:"pattern"`
Properties map[string]*Schema `json:"properties,omitempty" yaml:"properties"`
Required []string `json:"required,omitempty" yaml:"required"`
Type string `json:"type,omitempty" yaml:"type"`
// AdditionalProperties is either a `false` to indicate that no additional
// properties in the object are allowed (beyond what's in Properties), or a
// JSON schema that describes the expected format of any additional properties.
//
// We currently just read it as an `interface{}` because we're not using it
// for anything right now.
AdditionalProperties interface{} `json:"additionalProperties,omitempty" yaml:"additionalProperties"`

AnyOf []*Schema `json:"anyOf,omitempty" yaml:"anyOf"`
Enum []interface{} `json:"enum,omitempty" yaml:"enum"`
Items *Schema `json:"items,omitempty" yaml:"items"`
Nullable bool `json:"nullable,omitempty" yaml:"nullable"`
Pattern string `json:"pattern,omitempty" yaml:"pattern"`
Properties map[string]*Schema `json:"properties,omitempty" yaml:"properties"`
Required []string `json:"required,omitempty" yaml:"required"`
Type string `json:"type,omitempty" yaml:"type"`

// Ref is populated if this JSON Schema is actually a JSON reference, and
// it defines the location of the actual schema definition.
Expand Down