Creuna-Oslo / prop-types-csharp

Generate C# classes from React component propTypes
MIT License
1 stars 2 forks source link

Support setting suffix for the top level class in each generated class file #39

Closed Sriess closed 5 years ago

Sriess commented 6 years ago

There should be an option to set a suffix that will be appended to all top level classes in each generated class file, to avoid naming conflicts when using the generated classes.

If I use the Episerver model "ContentArea", but I have a react model also named "ContentArea", I would either have to explicitly specify the namespace "EPiServer.CoreContentArea" or "ReactModels.ContentArea" to avoid an ambiguous reference. Alternatively I can specify an alias in the using statement for the react model like "using ContentAreaComponent = MyProject.Models.ReactModels.ContentArea", but this would have to be done in all files where there is a naming conflict.

Would be good if we could specify that each generated file and class be named something like "EventDataComponent" rather than "EventData". Classes like "EventData_ItemsItem" is not a top level class in it's own file, and poses no real likelihood of a name conflict, so it does not need the suffix.

asbjornh commented 6 years ago

Is it really important that this is a suffix rather than a prefix? From your examples, it seems like you already have the prefix ReactModels. from the namespace, and I can't see the big difference except one extra period.

I'm not sure one period less is worth the extra complexity this would add

asbjornh commented 5 years ago

Closing this as it does not seem necessary