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

Support generated projects with dots in the namespace #18

Closed landy closed 3 years ago

landy commented 3 years ago

Hello Zaid, I've encountered some "strange" behaviour. When I define Snoflaqe.json file like this

    "schema": "http://localhost:8085/graphql",
    "queries": "./gql-queries",
    "project": "Cookbook.GraphQL.Client",
    "output": "./gql-output",
    "overrideClientName": "ClientGraphqlClient"
}

then the namespaces in the generated project are created in quotes like this

namespace rec ``Cookbook.GraphQL.Client``

and project in this state throws compilation errors.

Is this "by design" or did I encountered some bug?

It can be solved by removing the dots from the project name but then I endup with project whose name doesn't match the rest of the projects in sln.

Zaid-Ajaj commented 3 years ago

Hi there @landy,

Currently this is by design because I tend to choose the simplest defaults. Having dots in the project file sounds like something easy but it complicates the project structure quite a bit. I can look into it sometime soon but I can't promise a timeline. I do however accept PRs in case you are feeling adventurous and want to take a stab at it :wink:

landy commented 3 years ago

Thank you for a quick response! 👍 I will look into it if I have some free time. Currently it's just a minor thing in a personal side project so nothing major really :)

Zaid-Ajaj commented 3 years ago

I will look into it if I have some free time. Currently it's just a minor thing in a personal side project so nothing major really :)

Sounds great! I will reopen the issue for now so that I don't forget about it :smile:

Zaid-Ajaj commented 3 years ago

Hi @landy, the issue turned out to be relatively doable. A project name with dots in it should be supported as of Snowflaqe v1.9 :rocket: You can update the version as follows:

dotnet tool update snowflaqe -g

Let me know if something doesn't work for you :wink:

landy commented 3 years ago

wow! 🥇 I will give it a try. Thank you

landy commented 3 years ago

Works like a charm! Thanks again 👍