ChilliCream / graphql-platform

Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
https://chillicream.com
MIT License
5.13k stars 731 forks source link

Default name of `fsp` #6576

Open PascalSenn opened 11 months ago

PascalSenn commented 11 months ago

Product

Hot Chocolate

Is your feature request related to a problem?

Currently the default name of the fsp of dotnet fusion pack is the name of the Folder it is packed in

This default behaviour makes it harder to integrate into a CI pipeline as you always have to specify --package to get a consistent output.

e.g. for a simple build script you get:

dotnet tool restore
dotnet build
dotnet run -p Subgraphs/Accounts -- schema export --output schema.graphql
dotnet run -p Subgraphs/Products -- schema export --output schema.graphql
dotnet run -p Subgraphs/Shipping -- schema export --output schema.graphql
dotnet run -p Subgraphs/Reviews -- schema export --output schema.graphql

dotnet fusion subgraph pack --working-directory ./Subgraphs/Accounts
dotnet fusion subgraph pack --working-directory ./Subgraphs/Products
dotnet fusion subgraph pack --working-directory ./Subgraphs/Shipping
dotnet fusion subgraph pack --working-directory ./Subgraphs/Reviews

 dotnet fusion compose -p ./Gateway/gateway.fgp -s ./Subgraphs/Accounts/accounts.fsp
 dotnet fusion compose -p ./Gateway/gateway.fgp -s ./Subgraphs/Products/products.fsp
 dotnet fusion compose -p ./Gateway/gateway.fgp -s ./Subgraphs/Shipping/shipping.fsp
 dotnet fusion compose -p ./Gateway/gateway.fgp -s ./Subgraphs/Reviews/reviews.fsp

if you want to have the same fsp names you have to specify:

dotnet tool restore
dotnet build
dotnet run -p Subgraphs/Accounts -- schema export --output schema.graphql
dotnet run -p Subgraphs/Products -- schema export --output schema.graphql
dotnet run -p Subgraphs/Shipping -- schema export --output schema.graphql
dotnet run -p Subgraphs/Reviews -- schema export --output schema.graphql

dotnet fusion subgraph pack --working-directory ./Subgraphs/Accounts --package subgraph.fsp
dotnet fusion subgraph pack --working-directory ./Subgraphs/Products --package subgraph.fsp
dotnet fusion subgraph pack --working-directory ./Subgraphs/Shipping --package subgraph.fsp
dotnet fusion subgraph pack --working-directory ./Subgraphs/Reviews --package subgraph.fsp

 dotnet fusion compose -p ./Gateway/gateway.fgp -s ./Subgraphs/Accounts/subgraph.fsp
 dotnet fusion compose -p ./Gateway/gateway.fgp -s ./Subgraphs/Products/subgraph.fsp
 dotnet fusion compose -p ./Gateway/gateway.fgp -s ./Subgraphs/Shipping/subgraph.fsp
 dotnet fusion compose -p ./Gateway/gateway.fgp -s ./Subgraphs/Reviews/subgraph.fsp

The solution you'd like

As you in most cases anyway have one subgraph document per service, i believe it would be better if the output is subgraph.fsp by default (and gateway.gsp on compose)

Because then we can also have defaults to assume that a subgraph contains a fsp. which makes the default behaviour a lot simpler:

dotnet tool restore
dotnet build
dotnet run -p Subgraphs/Accounts -- schema export --output schema.graphql
dotnet run -p Subgraphs/Products -- schema export --output schema.graphql
dotnet run -p Subgraphs/Shipping -- schema export --output schema.graphql
dotnet run -p Subgraphs/Reviews -- schema export --output schema.graphql

dotnet fusion subgraph pack --working-directory ./Subgraphs/Accounts 
dotnet fusion subgraph pack --working-directory ./Subgraphs/Products 
dotnet fusion subgraph pack --working-directory ./Subgraphs/Shipping
dotnet fusion subgraph pack --working-directory ./Subgraphs/Reviews 

 dotnet fusion compose -p ./Gateway -s ./Subgraphs/Accounts
 dotnet fusion compose -p ./Gateway -s ./Subgraphs/Products
 dotnet fusion compose -p ./Gateway -s ./Subgraphs/Shipping
 dotnet fusion compose -p ./Gateway -s ./Subgraphs/Reviews
michaelstaib commented 10 months ago

first...

dotnet fusion subgraph pack --working-directory ./Subgraphs/Accounts dotnet fusion subgraph pack --working-directory ./Subgraphs/Products dotnet fusion subgraph pack --working-directory ./Subgraphs/Shipping dotnet fusion subgraph pack --working-directory ./Subgraphs/Reviews

this is no longer needed

michaelstaib commented 10 months ago

in 13.6 you can compose without subgraph package