-
Notifications
You must be signed in to change notification settings - Fork 0
Update CI for OpenAPI and regenerate SDK #11
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
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
c2f11e9
fix(ci): correct 'file' to 'files' in Codecov action configuration
rhythmatician b81d2d3
Switch from Swagger to OpenAPI for SDK gen
rhythmatician a8f0141
Regenerate the SDK
rhythmatician 43546d8
feat(ci): add OpenAPI spec validation step to CI workflow
rhythmatician 69651fd
refactor(spec): remove unused models from API specification
rhythmatician a26eb19
fix: improve path parameter injection in OpenAPI spec
rhythmatician 6c4d788
feat(tests): enhance SDK generation tests with unique operation ID ha…
rhythmatician 494b8af
Regenerate SDK
rhythmatician 4457775
chore: add .flake8 configuration for line length enforcement
rhythmatician e0d07e3
fix: update asset service record query parameters to be optional and …
rhythmatician bb3b422
feat: implement fix for multiple schema issues in OpenAPI specificati…
rhythmatician c226b86
docs: update SDK regeneration instructions and clarify use of fix_swa…
rhythmatician a715f7a
docs: enhance docstring in fix_swagger_spec.py for clarity on schema …
rhythmatician 8a092ad
fix: ensure unique operationIds and apply schema fixes in patch_spec …
rhythmatician ea8eaf4
fix: update requirements to specify setuptools and pydantic versions,…
rhythmatician 3e164c2
fix: add pydantic version specification to dependencies in pyproject.…
rhythmatician 17cbca2
fix: correct formatting in setup.py by adjusting package declaration …
rhythmatician a3a8172
feat: Add exception handling and API response classes to the Qualer SDK
rhythmatician bf556c4
Revert "refactor(spec): remove unused models from API specification"
rhythmatician 8ef7a43
Regenerate SDK
rhythmatician 5055b98
fix: pin pydantic version to ensure compatibility across dependencies
rhythmatician ec07583
feat: Enhance SDK structure by creating custom __init__.py files and …
rhythmatician b9e48a4
fix: update Python version matrix in CI workflow to remove deprecated…
rhythmatician ca7c45d
fix: update Python version requirements to >=3.9 in setup and project…
rhythmatician 4786032
feat: add pytest configuration and improve test setup paths for bette…
rhythmatician f034af8
refactor: remove outdated test_setup.py file to streamline testing pr…
rhythmatician File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [flake8] | ||
| max-line-length = 127 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # Script to fix the multiple schema issues in the OpenAPI specification | ||
| import json | ||
| import sys | ||
|
|
||
|
|
||
| def fix_swagger_spec(input_file, output_file): | ||
| """Fix multiple schema issues in Swagger 2.0 spec. | ||
|
|
||
| When converting Swagger 2.0 to OpenAPI 3.0, multiple media types in "consumes" | ||
| and "produces" arrays get transformed into 'content' objects with multiple schemas. | ||
| This causes warnings like "Multiple schemas found in the OAS 'content' section, | ||
| returning only the first one" during SDK generation. | ||
|
|
||
| This function resolves the issue by keeping only the first content type in each | ||
| consumes/produces array, ensuring consistent behavior when the generator transforms | ||
| the spec to OpenAPI 3.0. | ||
|
|
||
| Args: | ||
| input_file: Path to the input Swagger 2.0 specification file | ||
| output_file: Path where the fixed specification will be saved | ||
| """ | ||
| with open(input_file, "r", encoding="utf-8") as f: | ||
| spec = json.load(f) | ||
|
|
||
| # When converting Swagger 2.0 to OpenAPI 3.0, the 'consumes' and 'produces' arrays | ||
| # get transformed into 'content' objects with multiple media types. | ||
| # Let's ensure consistent behavior by keeping only the first content type | ||
|
|
||
| # Global consumes/produces | ||
| if "consumes" in spec and len(spec["consumes"]) > 1: | ||
| spec["consumes"] = [spec["consumes"][0]] # Keep only the first content type | ||
|
|
||
| if "produces" in spec and len(spec["produces"]) > 1: | ||
| spec["produces"] = [spec["produces"][0]] # Keep only the first content type | ||
|
|
||
| # For each path and operation | ||
| for path_key, path_item in spec.get("paths", {}).items(): | ||
| for method, operation in path_item.items(): | ||
| if method in ["get", "post", "put", "delete", "patch", "options", "head"]: | ||
| if "consumes" in operation and len(operation["consumes"]) > 1: | ||
| operation["consumes"] = [operation["consumes"][0]] | ||
| if "produces" in operation and len(operation["produces"]) > 1: | ||
| operation["produces"] = [operation["produces"][0]] | ||
|
|
||
| # Write the fixed specification | ||
| with open(output_file, "w", encoding="utf-8") as f: | ||
| json.dump(spec, f, indent=2) | ||
|
|
||
| print(f"Fixed specification written to {output_file}") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| if len(sys.argv) != 3: | ||
| print(f"Usage: {sys.argv[0]} <input_file> <output_file>") | ||
| sys.exit(1) | ||
|
|
||
| fix_swagger_spec(sys.argv[1], sys.argv[2]) |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| [pytest] | ||
| pythonpath = . | ||
| testpaths = tests | ||
| python_files = test_*.py | ||
| python_classes = Test* | ||
| python_functions = test_* | ||
| addopts = -v --tb=short |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.