forked from bombsimon/jtd-infer-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.go
22 lines (20 loc) · 1.25 KB
/
schema.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package jtdinfer
import jtd "github.com/jsontypedef/json-typedef-go"
// Schema represents the JTD schema that will get inferred. It's a hard copy of
// the upstream type since we want and need to be able to omit empty fields.
// Ref: https://github.com/jsontypedef/json-typedef-go/issues/7
type Schema struct {
Definitions map[string]Schema `json:"definitions,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
Nullable bool `json:"nullable,omitempty"`
Ref *string `json:"ref,omitempty"`
Type jtd.Type `json:"type,omitempty"`
Enum []string `json:"enum,omitempty"`
Elements *Schema `json:"elements,omitempty"`
Properties map[string]Schema `json:"properties,omitempty"`
OptionalProperties map[string]Schema `json:"optionalProperties,omitempty"`
AdditionalProperties bool `json:"additionalProperties,omitempty"`
Values *Schema `json:"values,omitempty"`
Discriminator string `json:"discriminator,omitempty"`
Mapping map[string]Schema `json:"mapping,omitempty"`
}