jsonschemax: improve type guessing when $ref is used
zepatrik opened this issue · 2 comments
Describe the bug
Especially the array type looks for the type of it's items. If those are a reference it should use that reference to guess the type further.
To Reproduce
Steps to reproduce the behavior:
schema.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"foo": {
"type": "string",
"enum": [
"bar",
"baz"
]
}
},
"properties": {
"fooArray": {
"type": "array",
"items": {
"$ref": "#/definitions/foo"
}
}
}
}
paths, _ := jsonschemax.ListPaths(schemaRef, nil)
assert.Equal(t, []interface{}{}, paths[0].Type)
Expected behavior
paths, _ := jsonschemax.ListPaths(schemaRef, nil)
assert.Equal(t, []string{}, paths[0].Type)
I am marking this issue as stale as it has not received any engagement from the community or maintainers in over half a year. That does not imply that the issue has no merit! If you feel strongly about this issue
- open a PR referencing and resolving the issue;
- leave a comment on it and discuss ideas how you could contribute towards resolving it;
- open a new issue with updated details and a plan on resolving the issue.
We are cleaning up issues every now and then, primarily to keep the 4000+ issues in our backlog in check and to prevent maintainer burnout. Burnout in open source maintainership is a widespread and serious issue. It can lead to severe personal and health issues as well as enabling catastrophic attack vectors.
Thank you for your understanding and to anyone who participated in the issue! 🙏✌️
If you feel strongly about this issues and have ideas on resolving it, please comment. Otherwise it will be closed in 30 days!
Array types are now supported!