Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion oas.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ type SchemaObject struct {
Items *SchemaObject `json:"items,omitempty"` // use ptr to prevent recursive error
Example interface{} `json:"example,omitempty"`
Deprecated bool `json:"deprecated,omitempty"`
Nullable bool `json:"nullable,omitempty"`

// Ref is used when SchemaObject is as a ReferenceObject
Ref string `json:"$ref,omitempty"`
Expand All @@ -170,7 +171,6 @@ type SchemaObject struct {
// AdditionalProperties
// Description
// Default
// Nullable
// ReadOnly
// WriteOnly
// XML
Expand Down
13 changes: 13 additions & 0 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,19 @@ astFieldsLoop:
fieldSchema.Deprecated = true
continue astFieldsLoop
}
if kv := strings.Split(v, "="); len(kv) == 2 {
switch kv[0] {
case "type":
fieldSchema.Type = kv[1]
fieldSchema.Ref = ""

case "format":
fieldSchema.Format = kv[1]

case "nullable":
fieldSchema.Nullable, _ = strconv.ParseBool(kv[1])
}
}
}

if tag := astFieldTag.Get("json"); tag != "" {
Expand Down