Add a JSON Schema for what the JSON model should look like and validate against invalid JSON input
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- Go
- Stars
- 35
- Forks
- 17
- Avg merge
- 48m
- Merged PRs (30d)
- 10
Description
See: https://github.com/openfga/openfga/issues/1164
The below model is invalid because the intersection definition in the document#viewer relation is malformed. It’s missing a child: […] nested block.
{
"schema_version": "1.1",
"type_definitions": [
{
"type": "user"
},
{
"type": "folder",
"relations": {
"viewer": {"this": {}},
"parent": {"this": {}}
},
"metadata": {
"relations": {
"viewer": {
"directly_related_user_types": [{"type": "user"}]
},
"parent": {
"directly_related_user_types": [{"type": "folder"}]
}
}
}
},
{
"type": "document",
"relations": {
"parent": {"this": {}},
"viewer": {
"union": {
"child": [
{
"intersection": {
"tupleToUserset": {
"tupleset": {
"relation": "parent"
},
"computedUserset": {
"relation": "viewer"
}
}
}
},
{"this": {}}
]
}
}
},
"metadata": {
"relations": {
"parent": {
"directly_related_user_types": [{"type": "folder", "relation": "parent"}]
},
"viewer": {
"directly_related_user_types": [{"type": "user"}]
}
}
}
}
]
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue provides a malformed JSON model in its body and links to openfga/openfga#1164, but names no files, tests, or validation entry point. Start by locating the JSON model representation and its current parsing or validation path. Done means a JSON Schema exists and invalid input such as the supplied intersection example is rejected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, json
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100