-
Notifications
You must be signed in to change notification settings - Fork 138
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
Case when type is nullable #53
Comments
Sorry for the late reply, but do you have a complete example? |
A minimal example: {
"$schema": "http://json-schema.org/draft-07/schema#",
"id": "http://example.com/exampleschema.json",
"title": "Title",
"description": "Description",
"type": "object",
"properties": {
"topics": {
"type": "array",
"items": {
"type": "object",
"properties": {
"score": {
"type": [
"null",
"number"
]
}
},
"required": [
"score"
]
}
},
"last_read": {"type": "null"},
"rights": {
"type": [
"null",
"string"
]
},
"resource_links": {
"anyOf": [
{"type": "null"},
{
"type": "object",
"properties": {
"PropA": {"type": "string"},
"PropB": {"type": "string"}
}
}
]
},
"virtual_pages": {
"type": [
"integer",
"null"
]
},
"duration_seconds": {"type": "null"}
},
"required": [
"duration_seconds",
"last_read",
"resource_links",
"rights",
"topics",
"virtual_pages"
]
} With // Title Description
type Title struct {
DurationSeconds nil `json:"duration_seconds"` // error here
LastRead nil `json:"last_read"` // error here also
ResourceLinks interface{} `json:"resource_links"`
Rights interface{} `json:"rights"`
Topics []*TopicsItems `json:"topics"`
VirtualPages interface{} `json:"virtual_pages"`
}
// TopicsItems
type TopicsItems struct {
Score interface{} `json:"score"`
} Basically |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could this multi-type
be interpreted as
*string
?same would go for
The text was updated successfully, but these errors were encountered: