10000 app: Add logic to handle $ref in parameters BNCH-125141 BNCH-125943 by peter-goldstein · Pull Request #231 · benchling/openapi-python-client · GitHub
[go: up one dir, main page]

Skip to content

app: Add logic to handle $ref in parameters BNCH-125141 BNCH-125943 #231

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 11 commits into from
May 27, 2025

Conversation

peter-goldstein
Copy link

The following is valid in the openapi spec:

paths:
  foos:
    get:
      parameters:
      - $ref: '#/components/parameters/barParam'

components:
  parameters:
    barParam:
      example: baz
      in: query
      name: bar
      schema:
        type: string

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

  • Update unit tests
  • Apply to our spec and see the missing $ref defined parameters in the generated methods

- 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0