forked from openapi-generators/openapi-python-client
-
Notifications
You must be signed in to change notification settings - Fork 1
app: Add logic to handle $ref in parameters BNCH-125141 BNCH-125943 #230
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
Open
peter-goldstein
wants to merge
12
commits into
peter.goldstein/fix
Choose a base branch
from
BNCH-125141-ref-parameters
base: peter.goldstein/fix
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
- Set ruler to 120 characters, which is the configured value in black - Set up vscode to use pytest with the same configuration as task unit - Turn off mypy in tests. They are so noncompliant that it's useless
This builds a library of parameter references from the openapi spec and gives a utility for looking them up.
This builds the actual Parameters object from the OpenAPI spec, using the logic we just added to schemas.
Intead of ignoring reference-typed parameters, look them up in the Parameters object.
* Update code to be editable Fix the prod/1.x branch so it's possible to run the client library generator from a local clone. #### Changes to make it work at all: `pyproject.toml` - We'll use python 3.9 because 3.7 is dead-dead - PyYAML <6 isn't installable anymore, thanks to PEP 517 - shellingham 1.5.0 was yanked, so we need a later version - Include type annotations for PyYAML for good measure #### Changes to make the generated output match what's already published: `poetry.lock` - Downgrade black so it tolerates leading and trailing spaces in triple- quoted strings - Upgrade autoflake to match the version in aurelia - Upgrade isort to match the version in aurelia `openapi_python_client/templates/pyproject.toml` - Enforce line length of 110 characters - Configure isort to use the same settings as in aurelia (don't separate by "from foo import" vs "import"; don't separate constants-style imports from other imports) `openapi_python_client/__init__.py` - Run autoflake from outside the generated client package. This sidesteps an issue where [autoflake will crash if it runs against a file called types.py](https://discuss.python.org/t/my-python-dont-work/80726). We have a file called types.py. * Run poetry lock * Fix unit tests * Fix flake8 * Remove difficult-to-fix checks and add todo's * Pin the black version
2937710
to
37d6a1a
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The following is valid in the openapi spec:
In December of 2020, when we diverged from the upstream branch, the client generator could not yet handle
$ref
in the parameters list. They added that feature in August 2022 but we never pulled it in.In this PR, I try to pull in the same implementation from the upstream while modifying our repo as little as possible. Only the tests are really hand-written.
Testing
$ref
defined parameters in the generated methods