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
Is your feature request related to a problem? Please describe.
When two components have an enum field with the same name, the second Enum class generated is just incremented with a number. For instance, given a field status, the two generated classes will be Status and Status1. It makes for a rather unhelpful name.
I think the best thing to have for compatibility here might be to add an option to the generator which will prepend the component name to the generated Enum class.
For example, given the example above the two generated Enums would be CheckoutRecordStatus and TaskStatus. Naming collision is very unlikely in this case and the names are much more helpful.
The text was updated successfully, but these errors were encountered:
As an addendum, this is more than just a cosmetic nicety. As we add fields to the spec that would generate the same Enum names, order is not guaranteed. Something that was previously Status could become Status1 and break compatibility with code already relying on Status which is now a different Enum set.
Great suggestion, I think we should just always prepend the source of inline (properties) enums to be more obvious. If declared as a top level component it will still use the title / name.
I think semantically, if not always in practice, an inline enum suggests it's only for that one component where a top level component enum suggests it's shared in multiple places (ref).
It will be a breaking change for existing clients, but I think the improvement in usability is worth making it the new standard behavior instead of an opt-in.
Is your feature request related to a problem? Please describe.
When two components have an enum field with the same name, the second
Enum
class generated is just incremented with a number. For instance, given a fieldstatus
, the two generated classes will beStatus
andStatus1
. It makes for a rather unhelpful name.Given spec snippet:
Generates
Enum
classes:Describe the solution you'd like
I think the best thing to have for compatibility here might be to add an option to the generator which will prepend the component name to the generated
Enum
class.For example, given the example above the two generated
Enum
s would beCheckoutRecordStatus
andTaskStatus
. Naming collision is very unlikely in this case and the names are much more helpful.The text was updated successfully, but these errors were encountered: