openapi-generators / openapi-python-client

Generate modern Python clients from OpenAPI
MIT License
1.34k stars 202 forks source link

Generator fails on OAuth2PasswordRequestForm contents #855

Open roggenbrot42 opened 1 year ago

roggenbrot42 commented 1 year ago

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):

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

lshigupt commented 6 months ago

May I also ask If I can use the AuthenticatedClient in order to support the AWS IAM role for authentication as well ?

As I can see we can use httpx_args: A dictionary of additional arguments in order to pass it in that class.

I assume We can use httpx_args to pass an IAM role for authentication ?

Looking forward to it.

Thanks in advance.