From 3477baa7360883ceef762425726a3bd3b15d6d5d Mon Sep 17 00:00:00 2001 From: meskill <8974488+meskill@users.noreply.github.com> Date: Fri, 27 Dec 2024 15:08:55 +0000 Subject: [PATCH] migrate generation config --- docs/cli.md | 25 ++++++++++++++++++++++ docs/config-generation.md | 44 +++++++++++++++++++++++++++++++-------- 2 files changed, 60 insertions(+), 9 deletions(-) diff --git a/docs/cli.md b/docs/cli.md index 3e0b63327..187852835 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -244,6 +244,31 @@ preset: +--- + + + + +```yaml +server: + port: 8000 +links: + - src: main.graphql +``` + + + + + +```graphql + +``` + + + + +--- + ### Inputs The `inputs` section specifies the sources from which the GraphQL configuration should be generated. Each source can be either a REST endpoint or a protobuf file. diff --git a/docs/config-generation.md b/docs/config-generation.md index ab3e1564c..3533e197b 100644 --- a/docs/config-generation.md +++ b/docs/config-generation.md @@ -420,11 +420,21 @@ Let's understand the above configuration file. **Schema**: Specifies the name of the Query operation type, which is `Query` in this example. -```graphql showLineNumbers title="Generated GraphQL Configuration" -schema @link(src: "./news.proto", type: Protobuf) { - query: Query -} + + + +```yaml title="Generated GraphQL Configuration" +links: + - src: main.graphql + - type: Protobuf + src: ./news.proto +``` + + + + +```graphql showLineNumbers title="Generated GraphQL Configuration" type News @tag(id: "news.News") { id: Int title: String @@ -437,6 +447,9 @@ type Query { } ``` + + + for more insights on how gPRC works with GraphQL, you can read this [GraphQL over gRPC](grpc.md) article. ### Hybrid Integration (REST + gRPC) @@ -540,12 +553,22 @@ tailcall gen ./config.json **Schema**: Specifies the name of the Query operation type, which is `Query` in this example. -```graphql showLineNumbers -schema @link(src: "./news.proto", type: Protobuf) { - query: Query -} + + -type News @tag(id: "news.News") { +```yaml title="Generated GraphQL Configuration" +links: + - src: main.graphql + - type: Protobuf + src: ./news.proto +``` + + + + + +```graphql showLineNumbers title="Generated GraphQL Configuration" +type News { id: Int title: String content: String @@ -566,6 +589,9 @@ type Query { } ``` + + + ## Understanding Presets This section is optional and can be used to generate a more optimized configuration by applying various transformers that improve the config generation process, such as automatically inferring meaningful names of the types, merging duplicate types, removing unused types, and more. If you find that the generated GraphQL configuration is sufficient for your needs, you can skip this section.