Skip to content

Null types are not handled #1643

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
rveciana opened this issue Jul 11, 2023 · 0 comments
Open

Null types are not handled #1643

rveciana opened this issue Jul 11, 2023 · 0 comments
Assignees

Comments

@rveciana
Copy link

I'm using FastAPI 100, that creates OpenAPI version 3.1 as an output.

I want an object with arrays with elements of a type or null, such as:

data: dict[str, list[float|None] | list[int|None]]

Before, the None was ignored when generating the OpenAPI file, but now, the generated file looks like:

"additionalProperties": 
              "anyOf": [
                {
                  "items": {
                    "anyOf": [{ "type": "number" }, { "type": "null" }]
                  },
                  "type": "array"
                },
                {
                  "items": {
                    "anyOf": [{ "type": "integer" }, { "type": "null" }]
                  },
                  "type": "array"
                }]}

Then, openapi-typescript-gen creates wrong types like this:

data: Record<string,> 

instead of:

    data: Record<string, (Array<number|null> | Array<string|null>)>;

Looking at the code, I can't see the place where openapi-typescript-gen processes the type null.

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

No branches or pull requests

2 participants