graphql
Runs a query or mutation of the GraphQL API in process as the run's user, and keeps its answer for references.
A step of a YAML migration with type: graphql. The class expMigrationStepGraphql (kernel/classes/migration/steps/expmigrationstepgraphql.php) is registered in settings/migration.ini [StepSettings] StepTypeList[graphql].
Keys
| Key | Type | Default | What it is |
|---|---|---|---|
persisted | string | a persisted query: its name or its SHA-256 | |
query | string | the text of the query or mutation | |
file | string | a .graphql file next to the migration | |
variables | map | the variables, name => value (references allowed) | |
operation | string | the operation to run when the text has several | |
allow_errors | bool | false | true: an answer with errors passes when it has data |
Besides these, every step takes the keys of the engine: type, mode, if, references, environments, engines and comment (the file format). A key of type identifier names a node, an object or another part of the installation by id, remote id, path or name (identifiers).
Values for references
references: { <name>: <value> } keeps a value of the step's result as ${ref.<name>} for the steps and migrations after it:
| Value | What it is |
|---|---|
data | the data of the answer (a map of the root fields) |
result | the value of the first root field of the answer |
errors | the messages of the errors (a list, empty when there were none) |
Undoing
A step of this type does not undo itself: a migration with it needs down: or a rollback to its caption.
It touches no cache.
Example
- type: graphql
query: |
mutation ($parent: Int!) {
createContent(parentId: $parent, classIdentifier: "folder", fields: [ { identifier: "name", value: "News" } ]) { contentId nodeId }
}
variables: { parent: 2 }
references: { news: result }Related
Generated by ./console exp:help:examples from settings/migration.ini, kernel/classes/migration/steps/expmigrationstepgraphql.php. Do not edit this page: change the source and generate again (how). Free documentation: GFDL 1.3 or later.