I have a really bizarre issue where the string 'NO' (ISO country code for Norway - we need this literal string to be an enum value), as part of an enum, is getting serlialized to False
we have an enum of ISO codes that includes the literal string 'NO'
- I have tried this without quotes, and with both single and double
MyModel:
type: object
additionalProperties: false
required:
- country_code
properties:
country_code:
type: string
example: US
enum:
- 'AE'
- 'AR'
...
- 'NL'
- 'NO' <----------- have tried just NO, 'NO', and "NO"
- 'NZ'
...
using the generation flags:
--strict-types str bool
--set-default-enum-member
--enum-field-as-literal one
--use-default
--strict-nullable
--collapse-root-models
--output-model-type pydantic_v2.BaseModel
we get the following output!
class CountryCode(Enum):
AE = "AE"
AR = "AR"
...
NL = "NL"
False_ = False <------------- !!
NZ = "NZ"
...
'NO'
becomes False
! Can you please let me know how to not do that?
Thanks much
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too