You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
In my openapi.json, a parameter for one of my schemas has a string enum as its type, and a member of that enum as its default value.
In the generated client it has type Union[Unset, None] and default value UNSET.
Expected behavior
In the generated client, the schema's parameter should have type Union[Unset, MyEnum] and default value MyEnum.VALUE like in the openapi.json
Not sure if the first example was the same (URL doesn't go anywhere for me) but for the second one, it seems the problem is we don't support inline allOf an enum right now, only references. I'll adjust the issue title accordingly.
Activity
illagrenan commentedon Oct 13, 2021
I have the same problem with the latest
openapi-python-client==0.10.5. Here is the example of OpenAPI schema:{ "openapi": "3.0.2", "info": { "title": "Example JSON API", "version": "0.2.1", "description": "" }, "paths": { "/api/foo/bar": { "post": { "operationId": "foo_bar", "summary": " ", "parameters": [ { "in": "query", "name": "item", "schema": { "title": "Item", "type": "string" }, "required": true }, { "in": "query", "name": "operation_type", "schema": { "default": "aa", "allOf": [ { "title": "OperationType", "description": "An enumeration.", "enum": [ "aa", "bb", "cc" ], "type": "string" } ] }, "required": false } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "title": "Response", "type": "string" } } } } } } } }, "components": { "schemas": {} } }And here is the generated code:
Note that the
FooBarOperationTypeclass is missing attributes foroperation_type.dbanty commentedon Dec 16, 2021
Not sure if the first example was the same (URL doesn't go anywhere for me) but for the second one, it seems the problem is we don't support inline allOf an enum right now, only references. I'll adjust the issue title accordingly.
[-]string enum present on openapi.json is not used in client[/-][+]Support inline allOf enum[/+]