Skip to content

Spec errors #922

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

Closed
macmoritz opened this issue Jan 1, 2024 · 6 comments · Fixed by #975
Closed

Spec errors #922

macmoritz opened this issue Jan 1, 2024 · 6 comments · Fixed by #975

Comments

@macmoritz
Copy link

Describe the bug
I am trying to create a python client for the sentry api by using this generator.
Not sure if this issue belongs here or to sentry (cause of they created the schema).
Other generators work fine with this schema. See below.

OpenAPI Spec File
https://github.com/getsentry/sentry-api-schema/blob/main/openapi-derefed.json

Desktop (please complete the following information):

  • OS: Linux 6.6.8
  • Python Version: 3.11.6
  • openapi-python-client Version: 0.17.0

Additional context
Log

ERROR:root:52 validation errors for OpenAPI
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.get.responses.200.Response.content.application/json.schema.Reference.$ref
  Field required [type=missing, input_value={'type': 'array', 'items'...alProperties': False}]}}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.get.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].items.Reference.$ref
  Field required [type=missing, input_value={'oneOf': [{'type': 'obje...nalProperties': False}]}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.get.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].items.function-after[handle_nullable(), Schema].oneOf.0.Reference.$ref
  Field required [type=missing, input_value={'type': 'object', 'prope...ionalProperties': False}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.get.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].items.function-after[handle_nullable(), Schema].oneOf.0.function-after[handle_nullable(), Schema].properties.password.Reference.$ref
  Field required [type=missing, input_value={'type': 'object', 'prope...lean', 'enum': [True]}}}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.get.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].items.function-after[handle_nullable(), Schema].oneOf.0.function-after[handle_nullable(), Schema].properties.password.function-after[handle_nullable(), Schema].properties.hidden-secret.Reference.$ref
  Field required [type=missing, input_value={'type': 'boolean', 'enum': [True]}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.get.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].items.function-after[handle_nullable(), Schema].oneOf.0.function-after[handle_nullable(), Schema].properties.password.function-after[handle_nullable(), Schema].properties.hidden-secret.function-after[handle_nullable(), Schema].enum.list[nullable[int]].0
  Input should be a valid integer [type=int_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.5/v/int_type
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.get.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].items.function-after[handle_nullable(), Schema].oneOf.0.function-after[handle_nullable(), Schema].properties.password.function-after[handle_nullable(), Schema].properties.hidden-secret.function-after[handle_nullable(), Schema].enum.list[nullable[str]].0
  Input should be a valid string [type=string_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.5/v/string_type
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.get.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].items.function-after[handle_nullable(), Schema].oneOf.1.Reference.$ref
  Field required [type=missing, input_value={'type': 'object', 'prope...ionalProperties': False}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.get.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].items.function-after[handle_nullable(), Schema].oneOf.1.function-after[handle_nullable(), Schema].properties.secret_key.Reference.$ref
  Field required [type=missing, input_value={'type': 'object', 'prope...lean', 'enum': [True]}}}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.get.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].items.function-after[handle_nullable(), Schema].oneOf.1.function-after[handle_nullable(), Schema].properties.secret_key.function-after[handle_nullable(), Schema].properties.hidden-secret.Reference.$ref
  Field required [type=missing, input_value={'type': 'boolean', 'enum': [True]}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.get.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].items.function-after[handle_nullable(), Schema].oneOf.1.function-after[handle_nullable(), Schema].properties.secret_key.function-after[handle_nullable(), Schema].properties.hidden-secret.function-after[handle_nullable(), Schema].enum.list[nullable[int]].0
  Input should be a valid integer [type=int_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.5/v/int_type
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.get.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].items.function-after[handle_nullable(), Schema].oneOf.1.function-after[handle_nullable(), Schema].properties.secret_key.function-after[handle_nullable(), Schema].properties.hidden-secret.function-after[handle_nullable(), Schema].enum.list[nullable[str]].0
  Input should be a valid string [type=string_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.5/v/string_type
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.get.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].items.function-after[handle_nullable(), Schema].oneOf.2.Reference.$ref
  Field required [type=missing, input_value={'type': 'object', 'prope...ionalProperties': False}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.get.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].items.function-after[handle_nullable(), Schema].oneOf.2.function-after[handle_nullable(), Schema].properties.private_key.Reference.$ref
  Field required [type=missing, input_value={'type': 'object', 'prope...lean', 'enum': [True]}}}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.get.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].items.function-after[handle_nullable(), Schema].oneOf.2.function-after[handle_nullable(), Schema].properties.private_key.function-after[handle_nullable(), Schema].properties.hidden-secret.Reference.$ref
  Field required [type=missing, input_value={'type': 'boolean', 'enum': [True]}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.get.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].items.function-after[handle_nullable(), Schema].oneOf.2.function-after[handle_nullable(), Schema].properties.private_key.function-after[handle_nullable(), Schema].properties.hidden-secret.function-after[handle_nullable(), Schema].enum.list[nullable[int]].0
  Input should be a valid integer [type=int_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.5/v/int_type
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.get.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].items.function-after[handle_nullable(), Schema].oneOf.2.function-after[handle_nullable(), Schema].properties.private_key.function-after[handle_nullable(), Schema].properties.hidden-secret.function-after[handle_nullable(), Schema].enum.list[nullable[str]].0
  Input should be a valid string [type=string_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.5/v/string_type
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.get.responses.200.Reference.$ref
  Field required [type=missing, input_value={'content': {'application...}}}}, 'description': ''}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.put.responses.200.Response.content.application/json.schema.Reference.$ref
  Field required [type=missing, input_value={'oneOf': [{'type': 'obje...nalProperties': False}]}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.put.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.0.Reference.$ref
  Field required [type=missing, input_value={'type': 'object', 'prope...ionalProperties': False}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.put.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.0.function-after[handle_nullable(), Schema].properties.password.Reference.$ref
  Field required [type=missing, input_value={'type': 'object', 'prope...lean', 'enum': [True]}}}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.put.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.0.function-after[handle_nullable(), Schema].properties.password.function-after[handle_nullable(), Schema].properties.hidden-secret.Reference.$ref
  Field required [type=missing, input_value={'type': 'boolean', 'enum': [True]}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.put.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.0.function-after[handle_nullable(), Schema].properties.password.function-after[handle_nullable(), Schema].properties.hidden-secret.function-after[handle_nullable(), Schema].enum.list[nullable[int]].0
  Input should be a valid integer [type=int_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.5/v/int_type
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.put.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.0.function-after[handle_nullable(), Schema].properties.password.function-after[handle_nullable(), Schema].properties.hidden-secret.function-after[handle_nullable(), Schema].enum.list[nullable[str]].0
  Input should be a valid string [type=string_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.5/v/string_type
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.put.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.1.Reference.$ref
  Field required [type=missing, input_value={'type': 'object', 'prope...ionalProperties': False}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.put.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.1.function-after[handle_nullable(), Schema].properties.secret_key.Reference.$ref
  Field required [type=missing, input_value={'type': 'object', 'prope...lean', 'enum': [True]}}}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.put.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.1.function-after[handle_nullable(), Schema].properties.secret_key.function-after[handle_nullable(), Schema].properties.hidden-secret.Reference.$ref
  Field required [type=missing, input_value={'type': 'boolean', 'enum': [True]}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.put.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.1.function-after[handle_nullable(), Schema].properties.secret_key.function-after[handle_nullable(), Schema].properties.hidden-secret.function-after[handle_nullable(), Schema].enum.list[nullable[int]].0
  Input should be a valid integer [type=int_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.5/v/int_type
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.put.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.1.function-after[handle_nullable(), Schema].properties.secret_key.function-after[handle_nullable(), Schema].properties.hidden-secret.function-after[handle_nullable(), Schema].enum.list[nullable[str]].0
  Input should be a valid string [type=string_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.5/v/string_type
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.put.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.2.Reference.$ref
  Field required [type=missing, input_value={'type': 'object', 'prope...ionalProperties': False}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.put.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.2.function-after[handle_nullable(), Schema].properties.private_key.Reference.$ref
  Field required [type=missing, input_value={'type': 'object', 'prope...lean', 'enum': [True]}}}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.put.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.2.function-after[handle_nullable(), Schema].properties.private_key.function-after[handle_nullable(), Schema].properties.hidden-secret.Reference.$ref
  Field required [type=missing, input_value={'type': 'boolean', 'enum': [True]}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.put.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.2.function-after[handle_nullable(), Schema].properties.private_key.function-after[handle_nullable(), Schema].properties.hidden-secret.function-after[handle_nullable(), Schema].enum.list[nullable[int]].0
  Input should be a valid integer [type=int_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.5/v/int_type
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.put.responses.200.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.2.function-after[handle_nullable(), Schema].properties.private_key.function-after[handle_nullable(), Schema].properties.hidden-secret.function-after[handle_nullable(), Schema].enum.list[nullable[str]].0
  Input should be a valid string [type=string_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.5/v/string_type
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.put.responses.200.Reference.$ref
  Field required [type=missing, input_value={'content': {'application...}}}}, 'description': ''}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.post.responses.201.Response.content.application/json.schema.Reference.$ref
  Field required [type=missing, input_value={'oneOf': [{'type': 'obje...nalProperties': False}]}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.post.responses.201.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.0.Reference.$ref
  Field required [type=missing, input_value={'type': 'object', 'prope...ionalProperties': False}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.post.responses.201.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.0.function-after[handle_nullable(), Schema].properties.password.Reference.$ref
  Field required [type=missing, input_value={'type': 'object', 'prope...lean', 'enum': [True]}}}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.post.responses.201.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.0.function-after[handle_nullable(), Schema].properties.password.function-after[handle_nullable(), Schema].properties.hidden-secret.Reference.$ref
  Field required [type=missing, input_value={'type': 'boolean', 'enum': [True]}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.post.responses.201.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.0.function-after[handle_nullable(), Schema].properties.password.function-after[handle_nullable(), Schema].properties.hidden-secret.function-after[handle_nullable(), Schema].enum.list[nullable[int]].0
  Input should be a valid integer [type=int_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.5/v/int_type
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.post.responses.201.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.0.function-after[handle_nullable(), Schema].properties.password.function-after[handle_nullable(), Schema].properties.hidden-secret.function-after[handle_nullable(), Schema].enum.list[nullable[str]].0
  Input should be a valid string [type=string_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.5/v/string_type
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.post.responses.201.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.1.Reference.$ref
  Field required [type=missing, input_value={'type': 'object', 'prope...ionalProperties': False}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.post.responses.201.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.1.function-after[handle_nullable(), Schema].properties.secret_key.Reference.$ref
  Field required [type=missing, input_value={'type': 'object', 'prope...lean', 'enum': [True]}}}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.post.responses.201.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.1.function-after[handle_nullable(), Schema].properties.secret_key.function-after[handle_nullable(), Schema].properties.hidden-secret.Reference.$ref
  Field required [type=missing, input_value={'type': 'boolean', 'enum': [True]}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.post.responses.201.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.1.function-after[handle_nullable(), Schema].properties.secret_key.function-after[handle_nullable(), Schema].properties.hidden-secret.function-after[handle_nullable(), Schema].enum.list[nullable[int]].0
  Input should be a valid integer [type=int_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.5/v/int_type
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.post.responses.201.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.1.function-after[handle_nullable(), Schema].properties.secret_key.function-after[handle_nullable(), Schema].properties.hidden-secret.function-after[handle_nullable(), Schema].enum.list[nullable[str]].0
  Input should be a valid string [type=string_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.5/v/string_type
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.post.responses.201.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.2.Reference.$ref
  Field required [type=missing, input_value={'type': 'object', 'prope...ionalProperties': False}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.post.responses.201.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.2.function-after[handle_nullable(), Schema].properties.private_key.Reference.$ref
  Field required [type=missing, input_value={'type': 'object', 'prope...lean', 'enum': [True]}}}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.post.responses.201.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.2.function-after[handle_nullable(), Schema].properties.private_key.function-after[handle_nullable(), Schema].properties.hidden-secret.Reference.$ref
  Field required [type=missing, input_value={'type': 'boolean', 'enum': [True]}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.post.responses.201.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.2.function-after[handle_nullable(), Schema].properties.private_key.function-after[handle_nullable(), Schema].properties.hidden-secret.function-after[handle_nullable(), Schema].enum.list[nullable[int]].0
  Input should be a valid integer [type=int_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.5/v/int_type
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.post.responses.201.Response.content.application/json.schema.function-after[handle_nullable(), Schema].oneOf.2.function-after[handle_nullable(), Schema].properties.private_key.function-after[handle_nullable(), Schema].properties.hidden-secret.function-after[handle_nullable(), Schema].enum.list[nullable[str]].0
  Input should be a valid string [type=string_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.5/v/string_type
paths./api/0/projects/{organization_slug}/{project_slug}/symbol-sources/.post.responses.201.Reference.$ref
  Field required [type=missing, input_value={'content': {'application...}}}}, 'description': ''}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing

Working generator
OpenAPITools/openapi-generator
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate -i /local/openapi.json -g python -o /local/out/python

@benedikt-bartscher

@macmoritz
Copy link
Author

If I remove the path /api/0/projects/{organization_slug}/{project_slug}/symbol-sources/ from the schema file (which is the only path with errors), I get this error:
ERROR:root:Incorrect path templating for /api/0/organizations/{organization_slug}/monitors/{monitor_slug}/checkins/ (Path parameters do not match with path)

Don't know how this works/sticks together.

@dbanty
Copy link
Collaborator

dbanty commented Jan 1, 2024

Alright, there are at least 3 issues I've found so far 😁:

  1. The spec uses boolean enums, these are valid OpenAPI but not supported by this generator yet. These shouldn't be parsing errors, though, that's a bug. It should just skip the endpoint that requires them and move on. So that's one thing to fix 🐛
  2. The path templating is actually wrong—that endpoint declares a checkin_id path parameter, but there's nowhere in the path to put it. There may be some edge case with OpenAPI about what you're supposed to do with extra path parameters, I'll have to poke around at the spec to be confident, but it seems like an error in the document.
  3. /components/schemas/OrganizationMemberWithRoles has both an is_global and isGlobal property. I think this is an error in the document even though it's technically valid OpenAPI. This appears in several other places as well. However, instead of producing an error, the generator is producing duplicate properties, which is invalid Python code. So that's another bug for me to fix 🐛

So, if you remove the bits that cause errors for 2 & 3 (like the modified attached spec), you can use the new branch on #923 (which somewhat supports bool enums) to generate the client now 😁.

modified-openapi.json

@macmoritz macmoritz changed the title Spec errors: Spec errors Jan 1, 2024
dbanty added a commit that referenced this issue Jan 4, 2024
This PR was created by Knope. Merging it will create a new release

### Features

#### Export `Unset` types from generated `types.py` (#927)

#### Generate properties for some boolean enums

If a schema has both `type = "boolean"` and `enum` defined, a normal
boolean property will now be created.
Previously, the generator would error. 

Note that the generate code _will not_ correctly limit the values to the
enum values. To work around this, use the
OpenAPI 3.1 `const` instead of `enum` to generate Python `Literal`
types.

Thanks for reporting #922 @macmoritz!

### Fixes

#### Do not stop generation for invalid enum values

This generator only supports `enum` values that are strings or integers.
Previously, this was handled at the parsing level, which would cause the
generator to fail if there were any unsupported values in the document.
Now, the generator will correctly keep going, skipping only endpoints
which contained unsupported values.

Thanks for reporting #922 @macmoritz!

#### Fix lists within unions

Fixes #756 and #928. Arrays within unions (which, as of 0.17 includes
nullable arrays) would generate invalid code.

Thanks @kgutwin and @diesieben07!

#### Simplify type checks for non-required unions

Co-authored-by: GitHub <[email protected]>
@macmoritz
Copy link
Author

macmoritz commented Jan 4, 2024

Nice! Thanks for fixing boolean enums, works like a charm.
Regarding topic 2: At the first sight this looks like an error in the document. I will reinvestigate more before reporting it in the upstream project.

In total, the interesting point is, that the other generator mentioned above can work with both remaining issues. Maybe we can get some information there.

@macmoritz
Copy link
Author

I checked the openapi spec of sentry again and ensured that case 2 only occures in this endpoint. I opened an upstream issue for that (getsentry/sentry#62717).
This is a huge repository and I dont expect a fast solution. Lets wait a few days, maybe one week. Maybe we can find an other solution for this temporarily by implementing a overwrite, whichs refactors unused parameters to not-required or query params.

Regarding point 3: It seems that is_global is not equal to isGlobal in the sentry "cosmos". Here you can find the docs for one of the failing parts: Retrieve an Organization Member.
Would be great if we could respect there crazy naming and handle it as seperate as well.

@macmoritz
Copy link
Author

FYI: Sounds like Sentry will fix the schema, which resolves our point 2 (see above).

@dbanty
Copy link
Collaborator

dbanty commented Feb 20, 2024

I believe the only remaining issue (3 above, is_global vs isGlobal) will be fixed by #972

dbanty added a commit that referenced this issue Feb 22, 2024
This PR was created by Knope. Merging it will create a new release

### Breaking Changes

#### For custom templates, changed type of endpoint parameters

**This does not affect projects that are not using
`--custom-template-path`**

The type of these properties on `Endpoint` has been changed from
`Dict[str, Property]` to `List[Property]`:

- `path_parameters`
- `query_parameters`
- `header_parameters`
- `cookie_parameters`

If your templates are very close to the default templates, you can
probably just remove `.values()` anywhere it appears.

The type of `iter_all_parameters()` is also different, you probably want
`list_all_parameters()` instead.

#### Updated generated config for Ruff v0.2

This only affects projects using the `generate` command, not the
`update` command. The `pyproject.toml` file generated which configures
Ruff for linting and formatting has been updated to the 0.2 syntax,
which means it will no longer work with Ruff 0.1.

#### Updated naming strategy for conflicting properties

While fixing #922, some naming strategies were updated. These should
mostly be backwards compatible, but there may be
some small differences in generated code. Make sure to check your diffs
before pushing updates to consumers!

### Features

#### support httpx 0.27 (#974)

### Fixes

#### Allow parameters with names differing only by case

If you have two parameters to an endpoint named `mixedCase` and
`mixed_case`, previously, this was a conflict and the endpoint would not
be generated.
Now, the generator will skip snake-casing the parameters and use the
names as-is. Note that this means if neither of the parameters _was_
snake case, neither _will be_ in the generated code.

Fixes #922 reported by @macmoritz & @benedikt-bartscher.

#### Fix naming conflicts with properties in models with mixed casing

If you had an object with two properties, where the names differed only
by case, conflicting properties would be generated in the model, which
then failed the linting step (when using default config). For example,
this:

```yaml
type: "object"
properties:
  MixedCase:
    type: "string"
  mixedCase:
    type: "string"
```

Would generate a class like this:

```python
class MyModel:
    mixed_case: str
    mixed_case: str
```

Now, neither of the properties will be forced into snake case, and the
generated code will look like this:

```python
class MyModel:
    MixedCase: str
    mixedCase: str
```

Co-authored-by: GitHub <[email protected]>
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 a pull request may close this issue.

2 participants