ahultgren / swagger-elm

Generate Elm types and decoders based on a Swagger file
74 stars 9 forks source link

Name collisions when enums are also used as a response name #23

Open eeue56 opened 7 years ago

eeue56 commented 7 years ago

E.g type ResourceType = Text | Title | Article and type Article = Article ArticleRecord

ahultgren commented 7 years ago

This was caused by me listening to #7. I don't see any other solution than prefixing enum's, which is ugly. Maybe a config param is the solution again?

One solution which i would like in general would be to generate one file per definition. That would also solve naming of nested objects (eg instead of ParentChild it would be a module named Parent.Child. That way Resource.Type.Article would not collide with Article. However that would make recursive types impossible...

Speaking of that, do you know if there's any theoretical reason why modules can't have cyclical dependencies? I guess there are compiling reasons i know nothing about, but if functions and types can be recursive, and modules are just collections of functions and types, why not?