Skip to content

feat(hover): add missing descriptions for older json schema drafts#266

Open
adityayadav-dev wants to merge 1 commit intohyperjump-io:mainfrom
adityayadav-dev:main
Open

feat(hover): add missing descriptions for older json schema drafts#266
adityayadav-dev wants to merge 1 commit intohyperjump-io:mainfrom
adityayadav-dev:main

Conversation

@adityayadav-dev
Copy link
Copy Markdown

Summary

Adds missing hover tooltip descriptions for several keywords in draft-04, draft-06, and draft-07 that were previously left blank or missing. Also uncomments the corresponding test assertions that were marked as TODO.

Closes #256

Changes

language-server/src/features/hover.js

draft-04 — filled in empty descriptions for:

  • id — identifier for the schema resource
  • dependencies — rules evaluated when an object contains a certain property
  • exclusiveMaximum — strict less-than validation (boolean form in draft-04)
  • exclusiveMinimum — strict greater-than validation (boolean form in draft-04)
  • maximum — less-than-or-equal validation
  • minimum — greater-than-or-equal validation

draft-06 — added new entries for:

  • $id — identifier for the schema resource
  • dependencies — rules evaluated when an object contains a certain property

draft-07 — added new entries for:

  • $id — identifier for the schema resource
  • dependencies — rules evaluated when an object contains a certain property

language-server/src/features/hover.test.ts

Uncommented all TODO test assertions so the previously skipped keywords are now regression-tested:

  • draft-07: $id, dependencies
  • draft-06: $id, dependencies
  • draft-04: id, maximum, exclusiveMaximum, minimum, exclusiveMinimum, dependencies

Testing

All 5768 tests pass (24 test files), including the newly enabled hover assertions for all three drafts.

@adityayadav-dev
Copy link
Copy Markdown
Author

Hey @jdesrosiers , I have made the changes. Please take a look when you have time. Thanks!


// Draft-04
"https://json-schema.org/keyword/draft-04/id": ``,
"https://json-schema.org/keyword/draft-04/id": `This keyword declares an identifier for the schema resource. Learn more: https://www.learnjsonschema.com/2020-12/core/id/`,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This points to the 2020-12 documentation. It should point to draft-07. It's the same for draft-04/6/7, so let's choose the latest version. After draft-07, it works differently, so we shouldn't point to 2020-12.

// Draft-04
"https://json-schema.org/keyword/draft-04/id": ``,
"https://json-schema.org/keyword/draft-04/id": `This keyword declares an identifier for the schema resource. Learn more: https://www.learnjsonschema.com/2020-12/core/id/`,
"https://json-schema.org/keyword/draft-04/ref": `This keyword is used to reference a statically identified schema. Learn more: https://www.learnjsonschema.com/2020-12/core/ref/`,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should point to the draft-07 documentation.

"https://json-schema.org/keyword/draft-04/dependencies": ``,
"https://json-schema.org/keyword/draft-04/exclusiveMaximum": ``,
"https://json-schema.org/keyword/draft-04/exclusiveMinimum": ``,
"https://json-schema.org/keyword/draft-04/dependencies": `This keyword specifies rules that are evaluated if the instance is an object and contains a certain property. Learn more: https://json-schema.org/understanding-json-schema/reference/object#dependencies`,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's be consistent about referencing learnjsonschema.com. Use the draft-07 link.

Comment on lines +125 to +126
"https://json-schema.org/keyword/draft-04/exclusiveMaximum": `If true, validation succeeds if the numeric instance is strictly less than the given maximum. Learn more: https://json-schema.org/understanding-json-schema/reference/numeric#range`,
"https://json-schema.org/keyword/draft-04/exclusiveMinimum": `If true, validation succeeds if the numeric instance is strictly greater than the given minimum. Learn more: https://json-schema.org/understanding-json-schema/reference/numeric#range`,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the learnjsonschema.com link. This one should use link for draft-04.

Comment on lines +128 to +129
"https://json-schema.org/keyword/draft-04/maximum": `Validation succeeds if the numeric instance is less than or equal to the given number. Learn more: https://www.learnjsonschema.com/2020-12/validation/maximum/`,
"https://json-schema.org/keyword/draft-04/minimum": `Validation succeeds if the numeric instance is greater than or equal to the given number. Learn more: https://www.learnjsonschema.com/2020-12/validation/minimum/`,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to use link for draft-04.

Comment on lines +132 to +138
"https://json-schema.org/keyword/draft-06/$id": `This keyword declares an identifier for the schema resource. Learn more: https://www.learnjsonschema.com/2020-12/core/id/`,
"https://json-schema.org/keyword/draft-06/contains": `Validation succeeds if the instance contains an element that validates against this schema. Learn more: https://www.learnjsonschema.com/2020-12/applicator/contains/`,
"https://json-schema.org/keyword/draft-06/dependencies": `This keyword specifies rules that are evaluated if the instance is an object and contains a certain property. Learn more: https://json-schema.org/understanding-json-schema/reference/object#dependencies`,

// Draft-7
"https://json-schema.org/keyword/draft-07/$id": `This keyword declares an identifier for the schema resource. Learn more: https://www.learnjsonschema.com/2020-12/core/id/`,
"https://json-schema.org/keyword/draft-07/dependencies": `This keyword specifies rules that are evaluated if the instance is an object and contains a certain property. Learn more: https://json-schema.org/understanding-json-schema/reference/object#dependencies`,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these additions. There are no keywords with those identifiers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Missing Hover Descriptions for Older JSON Schema Drafts

2 participants