Is your feature request related to a problem? Please describe.
Attempting to parse an Enum with spaces in it causes an error.
Example component:
SampleComponent:
type: object
properties:
reason:
type: string
description: Component that won't parse
enum:
- Made in error
- Other
Produces an Enum entry with a name MADE IN ERROR which is invalid and results in models/reason.py: Cannot parse: 5:9: MADE IN ERROR = "Made in error"
Describe the solution you'd like
Replace spaces (and probably other similar characters) with underscore to produce:
class Reason(str, Enum):
MADE_IN_ERROR = "Made in error"
OTHER = "Other"
This could introduce some naming collision if say we had both "Made in error" and "Made:in:error" but that seems like this would solve almost all reasonable cases.
Describe alternatives you've considered
Currently we are not able to use an Enum for this.
Is your feature request related to a problem? Please describe.
Attempting to parse an Enum with spaces in it causes an error.
Example component:
Produces an
Enumentry with a nameMADE IN ERRORwhich is invalid and results inmodels/reason.py: Cannot parse: 5:9: MADE IN ERROR = "Made in error"Describe the solution you'd like
Replace spaces (and probably other similar characters) with underscore to produce:
This could introduce some naming collision if say we had both "Made in error" and "Made:in:error" but that seems like this would solve almost all reasonable cases.
Describe alternatives you've considered
Currently we are not able to use an
Enumfor this.