-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
[BUG] Python not serializing enums correctly #8377
Comments
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
So I see this working in our tests here: |
Values are strictly typed in the python generator. A string will not be accepted, you have to pass in an instance of Products. |
@spacether I understand the strictly typed issue. The problem is with the JSON it creates.
The request body is as follows:
|
Can you provide the endoint definition also? |
SandboxPublicTokenCreateRequest:
type: object
properties:
initial_products:
type: array
items:
$ref: '#/components/schemas/Products'
/sandbox/public_token/create:
post:
requestBody:
required: true
description: ""
content:
application/json:
schema:
$ref: '#/components/schemas/SandboxPublicTokenCreateRequest'
Products:
title: Products
enum:
- transactions
type: string |
Thanks! |
@cgfarmer4 can you try moving your initial_products definition into a component and $refing it? |
Thanks so much for jumping in to fix here @spacether. Will keep an eye on the merge. |
All merged |
@spacether do you expect this to land in |
The update is live in master branch now. |
Trying to stabilize on |
You're welcome. Thank you for submitting the issue. :) |
Bug Report Checklist
Description
I have an endpoint that accepts an enum as part of its request body. Whenever I pass
Products.allowed_values[('value',)]["TRANSACTIONS"]
as the value I get the failure:Python model serialization fails when type is not
Products('transactions')
.openapi-generator version
Docker CLI v5
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Pass in
Products('transactions')
to the endpoint and get JSON as{value: 'transactions'}
. Should be just'transactions'
.Pass in
Products.allowed_values[('value',)]["TRANSACTIONS"]
and get the failure mentioned above.Related issues/PRs
#7058
Suggest a fix
The text was updated successfully, but these errors were encountered: