-
-
Notifications
You must be signed in to change notification settings - Fork 15
Extract subschema (to definitions) #132
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
Comments
@arpitkuriyal, Github won't let me assign you until you make a comment on the issue. So, please say hi or something and I'll assign you this issue. |
hello @jdesrosiers, looking forward to working on it. |
Hello @jdesrosiers, could you suggest any prerequisites I should go through before working on this to better understand the task? I am currently reading the VS Code Language Server Extension guide for reference. |
There's not much. I've found the resources on writing language servers to be quite bad. In general, you might find this youtube video helpful to get a feel for how language servers work. More specifically, The documentation for Code Actions should be helpful. I'm pretty sure Code Actions are what we'll use for this. The implementation will be in a new file in the features folder. |
Thanks for the resources !
|
Hello @jdesrosiers, When I attempt this: Screen.Recording.2025-02-19.at.1.19.06.AM.mov |
Wow, looks like great progress! If I understand your question correctly, I think you're looking for the |
Thanks! I didn’t know about allNodes function , but that sounds perfect. |
SchemaNode
s have anisSchema
property that can be used to know if something is a subschema.SchemaNode
also has akeywordUri
property. The keyword URI can be used to find theSchemaNode
for the definitions object. The keyword URI for definitions ishttps://json-schema.org/keyword/definitions
regardless of the draft. So, don't look for a property calleddefinitions
/$defs
in the schema, look for the node with with thehttps://json-schema.org/keyword/definitions
keyword URI.Example:
Before refactoring:
There should be a code action on the subschema at
/properties/bar
to extract the subschema to$defs
and replace it with a reference ($ref
) to the subschema in$defs
.After refactoring:
The text was updated successfully, but these errors were encountered: