Skip to content
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
103 changes: 103 additions & 0 deletions api-playground/graphql-setup.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
title: "GraphQL setup"
description: "Generate reference pages for your GraphQL API from a schema definition file, with linked types and example queries, mutations, and responses."
keywords: ["graphql", "schema", "sdl"]
---

## Add a GraphQL schema

To create pages for your GraphQL API, you need a valid GraphQL schema in SDL (Schema Definition Language) format. Store the schema in your documentation repository or host it at an HTTPS URL that Mintlify can fetch.

Check warning on line 9 in api-playground/graphql-setup.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

api-playground/graphql-setup.mdx#L9

Spell out 'SDL', if it's unfamiliar to the audience.

```graphql schema.graphql
"An object with a stable identifier."
interface Node {
id: ID!
}

type Organization implements Node {
id: ID!
name: String!
}

type Query {
organization(id: ID!): Organization
}
```

## Auto-populate GraphQL pages

To automatically generate pages for every query, mutation, and type in your schema, add a `graphql` property to a tab in your `docs.json`. Mintlify parses the schema and creates a page for each operation and named type.

<CodeGroup>

```json Local file
"navigation": {
"tabs": [
{
"tab": "GraphQL API",
"graphql": "schema.graphql"
}
]
}
```

```json Remote URL
"navigation": {
"tabs": [
{
"tab": "GraphQL API",
"graphql": "https://example.com/schema.graphql"
}
]
}
```

```json Custom directory
"navigation": {
"tabs": [
{
"tab": "GraphQL API",
"graphql": {
"source": "schema.graphql",
"directory": "api/graphql"
}
}
]
}
```

</CodeGroup>

The `graphql` property accepts either a string (a local path or HTTPS URL) or an object with the following fields.

<Note>
You must declare `graphql` on a [tab](/organize/navigation#tabs). A tab with `graphql` may include `groups`, but no other navigation structures, such as `pages`, `versions`, or `languages`. It also cannot include an `openapi` or `asyncapi` property.
</Note>

<ParamField path="source" type="string" required>
A local path to an SDL file in your documentation repository or an HTTPS URL to a hosted SDL file. Does not accept HTTP URLs.

Check warning on line 78 in api-playground/graphql-setup.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

api-playground/graphql-setup.mdx#L78

Spell out 'SDL', if it's unfamiliar to the audience.

Check warning on line 78 in api-playground/graphql-setup.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

api-playground/graphql-setup.mdx#L78

Spell out 'SDL', if it's unfamiliar to the audience.
</ParamField>

<ParamField path="directory" type="string">
The directory to store generated pages. Defaults to `graphql-reference`.
</ParamField>

## Generated pages

Mintlify organizes generated pages into three sections under the tab you configured:

- **Queries**: One page per field on your `Query` root type.
- **Mutations**: One page per field on your `Mutation` root type.
- **Types**: One page per named object, input, enum, interface, union, or scalar type.

Each operation page shows the field description, arguments, return type, and links to any referenced types. Query and mutation pages also include a generated example operation, the required variables, and a sample JSON response.

Type pages render the schema definition read-only, with linked field types so readers can navigate the graph.

## Deprecations

Fields and arguments that you mark with `@deprecated` in your schema display as deprecated on the generated pages. If you provide a deprecation reason, it appears next to the field.

## Update your documentation

Mintlify regenerates GraphQL reference pages when you run `mint dev` or when you push changes to your documentation repository. If your schema is hosted at an HTTPS URL, updates to the schema regenerate on the next build.

Check warning on line 103 in api-playground/graphql-setup.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

api-playground/graphql-setup.mdx#L103

In general, use active voice instead of passive voice ('is hosted').
1 change: 1 addition & 0 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
"api-playground/multiple-responses",
"api-playground/mdx-setup",
"api-playground/asyncapi-setup",
"api-playground/graphql-setup",
"api-playground/troubleshooting"
]
},
Expand Down
1 change: 1 addition & 0 deletions es.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"es/api-playground/multiple-responses",
"es/api-playground/mdx-setup",
"es/api-playground/asyncapi-setup",
"es/api-playground/graphql-setup",
"es/api-playground/troubleshooting"
]
},
Expand Down
113 changes: 113 additions & 0 deletions es/api-playground/graphql-setup.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
title: "Configuración de GraphQL"
description: "Genera páginas de referencia para tu API de GraphQL a partir de un archivo de definición de esquema, con tipos enlazados y ejemplos de consultas, mutaciones y respuestas."
keywords: ["graphql", "schema", "sdl"]
---

<div id="add-a-graphql-schema">
## Agrega un esquema de GraphQL
</div>

Para crear páginas para tu API de GraphQL, necesitas un esquema de GraphQL válido en formato SDL (Schema Definition Language). Almacena el esquema en tu repositorio de documentación o alójalo en una URL HTTPS que Mintlify pueda obtener.

```graphql schema.graphql
"An object with a stable identifier."
interface Node {
id: ID!
}

type Organization implements Node {
id: ID!
name: String!
}

type Query {
organization(id: ID!): Organization
}
```

<div id="auto-populate-graphql-pages">
## Generar automáticamente páginas de GraphQL
</div>

Para generar automáticamente páginas para cada consulta, mutación y tipo de tu esquema, agrega una propiedad `graphql` a una pestaña en tu `docs.json`. Mintlify analiza el esquema y crea una página para cada operación y tipo con nombre.

<CodeGroup>

```json Local file
"navigation": {
"tabs": [
{
"tab": "GraphQL API",
"graphql": "schema.graphql"
}
]
}
```

```json Remote URL
"navigation": {
"tabs": [
{
"tab": "GraphQL API",
"graphql": "https://example.com/schema.graphql"
}
]
}
```

```json Custom directory
"navigation": {
"tabs": [
{
"tab": "GraphQL API",
"graphql": {
"source": "schema.graphql",
"directory": "api/graphql"
}
}
]
}
```

</CodeGroup>

La propiedad `graphql` acepta ya sea una cadena (una ruta local o una URL HTTPS) o un objeto con los siguientes campos:

<ParamField path="source" type="string" required>
Una ruta local a un archivo SDL en tu repositorio de documentación o una URL HTTPS a un archivo SDL alojado. No se aceptan URL HTTP.
</ParamField>

<ParamField path="directory" type="string">
El directorio donde se colocan las páginas generadas. El valor predeterminado es `graphql-reference`.
</ParamField>

<Note>
Las fuentes de GraphQL solo se admiten en pestañas. Una pestaña que declara `graphql` no puede declarar también `openapi` o `asyncapi`.
</Note>

<div id="generated-pages">
## Páginas generadas
</div>

Mintlify organiza las páginas generadas en tres secciones dentro de la pestaña que configuraste:

- **Queries** — una página por cada campo de tu tipo raíz `Query`.
- **Mutations** — una página por cada campo de tu tipo raíz `Mutation`.
- **Types** — una página por cada tipo con nombre: object, input, enum, interface, union o scalar.

Cada página de operación muestra la descripción del campo, los argumentos, el tipo de retorno y enlaces a cualquier tipo referenciado. Las páginas de consultas y mutaciones también incluyen una operación de ejemplo generada, las variables requeridas y una respuesta JSON de muestra en el panel lateral (o en línea en dispositivos móviles).

Las páginas de tipos renderizan la definición del esquema en modo solo lectura, con los tipos de campo enlazados para que las personas que leen puedan navegar por el grafo.

<div id="deprecations">
## Deprecaciones
</div>

Los campos y argumentos marcados con `@deprecated` en tu esquema se señalan como obsoletos en las páginas generadas. El motivo de la deprecación, cuando se proporciona, aparece junto al campo.

<div id="update-your-documentation">
## Actualiza tu documentación
</div>

Mintlify regenera las páginas de referencia de GraphQL cuando ejecutas `mint dev` o cuando envías cambios a tu repositorio de documentación. Si tu esquema está alojado en una URL HTTPS, las actualizaciones del esquema se incorporan en la siguiente compilación.
1 change: 1 addition & 0 deletions fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"fr/api-playground/multiple-responses",
"fr/api-playground/mdx-setup",
"fr/api-playground/asyncapi-setup",
"fr/api-playground/graphql-setup",
"fr/api-playground/troubleshooting"
]
},
Expand Down
113 changes: 113 additions & 0 deletions fr/api-playground/graphql-setup.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
title: "Configuration de GraphQL"
description: "Générez des pages de référence pour votre API GraphQL à partir d’un fichier de définition de schéma, avec des types liés et des exemples de requêtes, mutations et réponses."
keywords: ["graphql", "schema", "sdl"]
---

<div id="add-a-graphql-schema">
## Ajouter un schéma GraphQL
</div>

Pour créer des pages pour votre API GraphQL, vous avez besoin d’un schéma GraphQL valide au format SDL (Schema Definition Language). Stockez le schéma dans votre dépôt de documentation ou hébergez-le à une URL HTTPS que Mintlify peut récupérer.

```graphql schema.graphql
"An object with a stable identifier."
interface Node {
id: ID!
}

type Organization implements Node {
id: ID!
name: String!
}

type Query {
organization(id: ID!): Organization
}
```

<div id="auto-populate-graphql-pages">
## Remplir automatiquement les pages GraphQL
</div>

Pour générer automatiquement des pages pour chaque requête, mutation et type de votre schéma, ajoutez une propriété `graphql` à un onglet dans votre `docs.json`. Mintlify analyse le schéma et crée une page pour chaque opération et chaque type nommé.

<CodeGroup>

```json Local file
"navigation": {
"tabs": [
{
"tab": "GraphQL API",
"graphql": "schema.graphql"
}
]
}
```

```json Remote URL
"navigation": {
"tabs": [
{
"tab": "GraphQL API",
"graphql": "https://example.com/schema.graphql"
}
]
}
```

```json Custom directory
"navigation": {
"tabs": [
{
"tab": "GraphQL API",
"graphql": {
"source": "schema.graphql",
"directory": "api/graphql"
}
}
]
}
```

</CodeGroup>

La propriété `graphql` accepte soit une chaîne (un chemin local ou une URL HTTPS), soit un objet avec les champs suivants :

<ParamField path="source" type="string" required>
Un chemin local vers un fichier SDL dans votre dépôt de documentation ou une URL HTTPS vers un fichier SDL hébergé. Les URL HTTP ne sont pas acceptées.
</ParamField>

<ParamField path="directory" type="string">
Le répertoire dans lequel les pages générées sont placées. Par défaut, `graphql-reference`.
</ParamField>

<Note>
Les sources GraphQL ne sont prises en charge que sur les onglets. Un onglet qui déclare `graphql` ne peut pas également déclarer `openapi` ou `asyncapi`.
</Note>

<div id="generated-pages">
## Pages générées
</div>

Mintlify organise les pages générées en trois sections sous l’onglet que vous avez configuré :

- **Queries** — une page par champ de votre type racine `Query`.
- **Mutations** — une page par champ de votre type racine `Mutation`.
- **Types** — une page par type nommé (object, input, enum, interface, union ou scalar).

Chaque page d’opération affiche la description du champ, les arguments, le type de retour et des liens vers tous les types référencés. Les pages de requêtes et de mutations comprennent également un exemple d’opération généré, les variables requises et un exemple de réponse JSON dans le panneau latéral (ou en ligne sur mobile).

Les pages de types affichent la définition du schéma en lecture seule, avec des types de champs liés afin que les lecteurs puissent naviguer dans le graphe.

<div id="deprecations">
## Dépréciations
</div>

Les champs et les arguments marqués avec `@deprecated` dans votre schéma sont signalés comme dépréciés sur les pages générées. La raison de la dépréciation, lorsqu’elle est fournie, apparaît à côté du champ.

<div id="update-your-documentation">
## Mettre à jour votre documentation
</div>

Mintlify régénère les pages de référence GraphQL lorsque vous exécutez `mint dev` ou lorsque vous poussez des modifications vers votre dépôt de documentation. Si votre schéma est hébergé à une URL HTTPS, les mises à jour du schéma sont prises en compte lors de la prochaine build.
1 change: 1 addition & 0 deletions zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
"zh/api-playground/multiple-responses",
"zh/api-playground/mdx-setup",
"zh/api-playground/asyncapi-setup",
"zh/api-playground/graphql-setup",
"zh/api-playground/troubleshooting"
]
},
Expand Down
Loading