openapi-generators / openapi-generators/openapi-python-client

Generator fails on OAuth2PasswordRequestForm contents

Open
#855 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2k
Forks
293
Avg merge
34m
Merged PRs (30d)
1

Description

Describe the bug
The generator reports validation errors on regarding the OAuth2PasswordRequestForm type:

components.schemas.Body_login_auth_login_post.Reference.$ref
  Field required [type=missing, input_value={'properties': {'grant_ty..._login_auth_login_post'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.3/v/missing
components.schemas.Body_login_auth_login_post.Schema.properties.grant_type.Reference.$ref
  Field required [type=missing, input_value={'anyOf': [{'type': 'stri..., 'title': 'Grant Type'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.3/v/missing
components.schemas.Body_login_auth_login_post.Schema.properties.grant_type.Schema.anyOf.1.Reference.$ref
  Field required [type=missing, input_value={'type': 'null'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.3/v/missing
components.schemas.Body_login_auth_login_post.Schema.properties.grant_type.Schema.anyOf.1.Schema.type
  Input should be 'string','number','integer','boolean','array' or 'object' [type=enum, input_value='null', input_type=str]
components.schemas.Body_login_auth_login_post.Schema.properties.client_id.Reference.$ref
  Field required [type=missing, input_value={'anyOf': [{'type': 'stri...], 'title': 'Client Id'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.3/v/missing
components.schemas.Body_login_auth_login_post.Schema.properties.client_id.Schema.anyOf.1.Reference.$ref
  Field required [type=missing, input_value={'type': 'null'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.3/v/missing
components.schemas.Body_login_auth_login_post.Schema.properties.client_id.Schema.anyOf.1.Schema.type
  Input should be 'string','number','integer','boolean','array' or 'object' [type=enum, input_value='null', input_type=str]
components.schemas.Body_login_auth_login_post.Schema.properties.client_secret.Reference.$ref
  Field required [type=missing, input_value={'anyOf': [{'type': 'stri...title': 'Client Secret'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.3/v/missing
components.schemas.Body_login_auth_login_post.Schema.properties.client_secret.Schema.anyOf.1.Reference.$ref
  Field required [type=missing, input_value={'type': 'null'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.3/v/missing
components.schemas.Body_login_auth_login_post.Schema.properties.client_secret.Schema.anyOf.1.Schema.type
  Input should be 'string','number','integer','boolean','array' or 'object' [type=enum, input_value='null', input_type=str]

OpenAPI Spec File
Example File: https://raw.githubusercontent.com/stustapay/stustapay/2812c74c622b11c2aa95d0f59933815c0daca4ed/api/administration.json

Desktop (please complete the following information):

  • OS: Fedora Linux 38
  • Python Version: 3.11.4
  • openapi-python-client version: 0.15.1

Additional context
Probably because of FastAPI 3.1.0 https://github.com/openapi-generators/openapi-python-client/discussions/818

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the generator validation errors with the linked administration.json OpenAPI spec, focusing on the OAuth2PasswordRequestForm fields and their nullable schemas. Done means the generator accepts this specification without validation errors and produces a valid client schema.

Written by the indexing model from the issue text.

Assessment

Tech stack
fastapi, python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.