Zaid-Ajaj / Snowflaqe

A dotnet CLI to generate type-safe GraphQL clients for F# and Fable with automatic deserialization, static query verification and type checking
MIT License
154 stars 25 forks source link

Put types into a namespace instead of module #33

Open xperiandri opened 3 years ago

xperiandri commented 3 years ago

Putting types into a module is not a good idea. As it causes some issues with their consumption from WPF/UWP/Uno

Zaid-Ajaj commented 3 years ago

Hi @xperiandri, can you tell me more about this issue? The global types are included as part of a namespace and the query-specific types are in a module inside that same namespace. What exactly needs to change / how does the expected output looks like?

xperiandri commented 3 years ago

You cannot instantiate nested types in XAML. For example to use as sample data to display on designer

Zaid-Ajaj commented 3 years ago

I see, that makes sense. Let me try to see what I can do. Unless you want to give it a try yourself :wink: PRs are always welcome

xperiandri commented 3 years ago

Is it fixed?

Zaid-Ajaj commented 3 years ago

Nope, didn't have time for it. Feel free to submit a PR for it 😄 it should be another boolean option. Maybe "nestedModuleTypes"? 🤔 where true is default, false -> generates namespaces instead

xperiandri commented 3 years ago

Could you point to the line where it happens?

Zaid-Ajaj commented 3 years ago

It happens here in the function CodeGen.generateQualifiedModule: https://github.com/Zaid-Ajaj/Snowflaqe/blob/master/src/Program.fs#L421