Skip to content

Commit

Permalink
migrate generation config
Browse files Browse the repository at this point in the history
  • Loading branch information
meskill committed Dec 27, 2024
1 parent 4d69c26 commit 3477baa
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 9 deletions.
25 changes: 25 additions & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,31 @@ preset:
</TabItem>
</Tabs>
---
<Tabs>
<TabItem value="config" label="main.yaml">
```yaml
server:
port: 8000
links:
- src: main.graphql
```
</TabItem>
<TabItem value="schema" label="main.graphql">
```graphql

```

</TabItem>
</Tabs>

---

### 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.
Expand Down
44 changes: 35 additions & 9 deletions docs/config-generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
<Tabs>
<TabItem value="config" label="main.yaml">

```yaml title="Generated GraphQL Configuration"
links:
- src: main.graphql
- type: Protobuf
src: ./news.proto
```

</TabItem>

<TabItem value="schema" label="main.graphql">

```graphql showLineNumbers title="Generated GraphQL Configuration"
type News @tag(id: "news.News") {
id: Int
title: String
Expand All @@ -437,6 +447,9 @@ type Query {
}
```

</TabItem>
</Tabs>

for more insights on how gPRC works with GraphQL, you can read this [GraphQL over gRPC](grpc.md) article.

### Hybrid Integration (REST + gRPC)
Expand Down Expand Up @@ -540,12 +553,22 @@ tailcall gen ./config.json
</Tabs>
**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
}
<Tabs>
<TabItem value="config" label="main.yaml">

type News @tag(id: "news.News") {
```yaml title="Generated GraphQL Configuration"
links:
- src: main.graphql
- type: Protobuf
src: ./news.proto
```

</TabItem>

<TabItem value="schema" label="main.graphql">

```graphql showLineNumbers title="Generated GraphQL Configuration"
type News {
id: Int
title: String
content: String
Expand All @@ -566,6 +589,9 @@ type Query {
}
```

</TabItem>
</Tabs>

## 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.
Expand Down

0 comments on commit 3477baa

Please sign in to comment.