-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
JSON serialization and schema generation #414
Conversation
c818c3e
to
f7b4591
Compare
So after a brief look I guess what I expected to see here is the serialize/deserialize and maybe schema implementations to live on the actual Parameters rather than the serialization class so that the approach can be easily extended. I'm happy to review further but that seemed like a pretty core part of the design we were talking about before so I'd like to hear about your reasoning here before diving deeper. |
Philipp, Jean-Luc, and I just met to discuss this approach, with some notes:
Actual IR->JSON should presumably be done using a JSONEncoder subclass (https://docs.python.org/3/library/json.html#json.JSONEncoder). |
Python IR SupportJust wanted to start making a list of types that I think the IR and therefore every serializer should (eventually) support.
Feel free to edit and expand. |
I agree with the above list. It is also keeping #382 as a reminder of what should be possible with JSON serialization (which I suspect will be the baseline for all serialization formats). |
Can you also make sure you handle ObjectSelector/Selector with enums in your initial PR? |
Also encode the |
Oh also ListSelector should be |
All good suggestions, thanks! I won't implement the regexp attribute for strings though as there is no easy/meaningful way to try to convert Python style regular expressions to equivalent javascript. |
Still more work to be done, but the suggested refactor and all of Philipp's suggestions are now implemented. |
@jbednar @philippjfr Coverage is very slightly down (-0.005%) but otherwise tests are passing. Other than the |
Co-authored-by: Philipp Rudiger <[email protected]>
@philippjfr @jbednar I think this PR is now in a useful state to merge. I'll go ahead and do that shortly unless you have any other suggestions or objections.. |
Looks good. Merge away. |
This PR outlines another attempt at serializing/deserializing to JSON (for reference see
#153 for earlier attempts at tackling this problem). The design used in this PR aims to try to keep things simpler but also adds the ability to generate JSON Schemas which should help with testing as well as specification of allowable parameter values (e.g this could be used to specify suitable widgets in panel).
This PR is based off the ideas suggested in #382.
TODO: