-
Notifications
You must be signed in to change notification settings - Fork 7
Adding script for generating Json schema for better maintainability #586
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
base: feat/add-programming-language-tag
Are you sure you want to change the base?
Adding script for generating Json schema for better maintainability #586
Conversation
…that can be used in the IDE a lot easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new Python script that transforms an existing JSON schema for the DSL translator into alternative schemas usable by the IDE. Key changes include:
- Adding functions to transform monolingual and multilingual JSON schemas.
- Implementing a command-line interface for generating different schema variants (strict and non-strict).
Files not reviewed (2)
- tested/dsl/schema-strict.json: Language not supported
- tested/dsl/schema.json: Language not supported
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…na-edu/universal-judge into feat/add-script-json-schema
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I was initially a fan of the idea, this code does not at all seem 'more maintainable' but actually 'more likely to cause unexpected bugs, when we ever update the json schema'
Also keeping the the version with natural translations as the source of truth to be managed in the future, doesn't seem like the best idea. This file is almost twice as long as the other schemas, with mostly duplicate fragments.
So I would assume the result being simpler if you automatically inserted that code in a script instead of automatically removing it
I have been researching better ways to do this (Also to keep the translations schema more manageable). I'll look into this further at a later date, but I am open for suggestions
The intention behind this script was to ensure that only a single JSON Schema and the script itself need to be maintained. In my view, this is still preferable to maintaining four separate schemas. I also prefer using the more detailed schema because, while it may be longer, it keeps the script significantly cleaner. Handling many specific cases (for example: where to use natural_language maps) in the script would otherwise make the code much harder to manage. There may be a more efficient way to approach this, but unfortunately, given the limited time I have remaining, I'm unsure if I'll be able to implement it. |
I added a script to generate a new Json schema from the multilingual json schema, used in the DSL translator, that can be used in the IDE.
This can be run by using:
This script can now also generate
schema.json
andschema-strict.json
based ofschema-strict-nat-translations.json
For this you would need to run:
or
Now only
schema-strict-nat-translations.json
andtransform_json.py
need to be maintained.