Edge cases and Gotchas
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
No files, tests, or entry points are named. Start by reviewing the repository and the JSON Schema examples in this issue, then identify how dialect changes, schema context, and embedded dialects should affect highlighting; done means these cases have defined and verified behavior.
Written by the indexing model from the issue text.
Description
Here are a few things to look out for when implementing something like this.
The set of properties that are considered keywords depends on the dialect
In the following example, additionalItems should not be highlighted as a keyword because it was removed in 2020-12.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"prefixItems": [true],
"additionalItems": false, // <- not a keyword
"items": false,
"definitions": {} // <- not a keyword
"aaa": 42 // <- not a keyword
}
When we change the dialect, the properties that are considered keywords changes.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"prefixItems": [true], // <- not a keyword
"additionalItems": false,
"items": false
"definitions": {}
"aaa": 42 // <- not a keyword
}
Properties are only keywords inside schemas
Not every object in a JSON Schema document is a schema, so you need to know when you're in a schema and when you're not. Here are a couple examples.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"$id": "foo" // <- not a keyword
}
}
In the next example, $id isn't considered a keyword because definitions isn't a keyword in 2020-12. Therefore, their values aren't schemas and the properties of those values shouldn't be considered keywords.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"definitions": {
"foo": {
"type": "string" // <- not a keyword
}
}
}
Embedded schemas can have a different dialect
It's possible for embedded schemas to have a different dialect than their parent schema. In the following example, the same keywords are highlighted differently depending on which schema resource the keyword appears in.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"prefixItems": [true],
"additionalItems": false, // <- not a keyword
"items": false,
"$defs": {
"foo": {
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://example.com/schema/embedded",
"prefixItems": [true], // <- not a keyword
"additionalItems": false,
"items": false,
"definitions": {}
}
}
}
- Dominant language
- Python
- Stars
- 1
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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.
More from python-jsonschema/jsonschema-lexer
-
Difficulty 3/5 1-2 days Newbie friendliness 30/100
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 45/100
All issues in python-jsonschema/jsonschema-lexer
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
web-push-libs/pywebpush#216 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
AgriciDaniel/claude-seo#572 ·
Maintainers usually reply within 5 days
-
area:print-dispatch
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
Maintainers usually reply within 1 day
-
area: docs domain: technical-writing good first issue type: documentation
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Deepak3699/Ai_Mentor#919 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day