Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add showcase #133

Merged
merged 11 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions docs/guides/playground.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: "Playground"
description: "Explore and test server configurations with @server directive's showcase feature in a controlled environment. Ideal for quick experimentation and learning with dynamic GraphQL schema configurations. Not recommended for production due to performance and security considerations."
---

The `@server` directive's `showcase` option allows for hands-on experimentation with server configurations in a controlled environment. This feature simplifies the process of exploring and testing different settings. This enables experimenting with random configurations hosted, without the need to restart the server or affect existing setups.

#### Example Usage

```graphql showLineNumbers
schema @server(showcase: true, graphiql: true) {
query: Query
}

type User {
notId: Int
notName: String
}

type Query {
notUser: User
@http(
path: "/users/1"
baseURL: "http://jsonplaceholder.typicode.com"
)
}
```

To test it out, append `/showcase/graphql?config=YOUR_CONFIG_URL` to your GraphQL base URL when querying the data.

![Showcase](/images/docs/showcase.png)

The above example shows loading a schema file from Tailcall's Github repository [examples](https://github.com/tailcallhq/tailcall/tree/main/examples) and querying it.

## Performance and Security

- **Performance Impact**: The `showcase` feature prioritizes flexibility and ease of testing over speed, leading to slower response times due to the overhead of dynamically applied configurations.
- **Security Risk**: There's a potential security risk as it may allow unauthorized access to files and environment variables.

:::important
Due to these concerns, this mode is **not recommended** for production environments.
:::
1 change: 1 addition & 0 deletions docs/operators/link.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "@link"
description: "Discover how the @link operator can transform your GraphQL schema, enabling seamless integration of external resources like configurations, .proto files, and SSL/TLS certificates for enhanced functionality and security. Learn to streamline and secure your GraphQL configurations with our comprehensive guide."
---

The **@link** operator is used for bringing external resources into your GraphQL schema. It makes it easier to include configurations, .proto files for gRPC services, and other files into your schema. With this operator, external resources are either merged with or used effectively in the importing configuration.
Expand Down
10 changes: 10 additions & 0 deletions docs/operators/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,16 @@ schema @server(key: "./key.pem") {
The key can be of any extension, but it's highly recommended to use standards (`pem`, `crt`, `key`).
:::

### showcase

The `@server` directive's `showcase` option allows for hands-on experimentation with server configurations in a controlled environment. This feature simplifies the process of exploring and testing different settings.

```graphql showLineNumbers
schema @server(showcase: true) {
query: Query
}
```

## batchRequests

Batching in GraphQL combines requests into one, reducing server round trips.
Expand Down
Binary file added static/images/docs/showcase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading