-
-
Notifications
You must be signed in to change notification settings - Fork 767
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
Support for _load_spec_from_json_module to use json.load() method to parse the .JSON specification. #1629
Comments
@hjacobs @RobbeSneyders FYI, |
Hi @smit-mehta25,
Would this still be relevant if Connexion would support splitting the specification into multiple files? Or would you still need it to merge the specifications before building your container to save on startup time?
This isn't possible, as Jinja templating needs to be resolved before parsing to a dict. |
@RobbeSneyders Hello, I am looking for performance improvement, splitting and merging the specifications are features if the connexion supports its plus one. I would suggest supporting a JSON parse in connexion as ultimately the Let me know if i could be more useful in implementing these features. Happy to contribute in each possible way. |
Ok thanks for the feedback. We'd welcome a contribution on this. |
Description
I have been using the connexion library for many years with the
flask
framework, I would like to highlight a few of the difficulties I have faced while using this package.base_path
and created multiple YAML modules. and, a main YAML for the end-points that are unique. later on, we faced performance issues as parsing YAML files (14-16 YAML modules) using prance was taking a huge time. So, we have written a script that will again merge the compiled/resolved specifications (prance.ResolvingParser(spec).specification
) into a single JSON module. (we used thedeepmerge
lib to merge all resolved specifications) since prance resolves the references and the output is serialized into the dictionary we have to use the JSON module. The performance issues are still there as the connexion uses theyaml.safe_load()
to load the specification from JSON modules.the process of merging all the compiled/resolved specifications into a single entry point will be done before the container builds to save processing time. and once the container builds the JSON module will be consumed by the
connexion_app.add_api
method at the start up time.@hjacobs @RobbeSneyders
Expected behavior
Actual behavior
As of now, the connexion library does not support a way to accept specifications as a path to the JSON module and use the
json.load
parser instead of theyaml.safe_load
method, while using theadd_api
method. Also, theargument
parameter should work for JSON specification as well for dict specification.Steps to reproduce
Additional info:
Output of the commands:
python --version
- python3pip show connexion | grep "^Version\:"
connexion version2.14.2
The text was updated successfully, but these errors were encountered: