graphql-engine/v3/open-dds/metadata.jsonschema
Puru Gupta 4b812d9b9a refactor command schema and IR (#261)
V3_GIT_ORIGIN_REV_ID: b2a7e3c591edeaf5aea3474b1e1f8492478ad95a
2024-01-08 10:41:13 +00:00

2775 lines
76 KiB
Plaintext

{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "OpenDdMetadata",
"description": "All of the metadata required to run Hasura v3 engine.",
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/OpenDdSubgraphObject"
}
},
{
"$ref": "#/definitions/OpenDdMetadataWithVersion"
}
],
"definitions": {
"OpenDdSubgraphObject": {
"oneOf": [
{
"$id": "https://hasura.io/jsonschemas/metadata/DataConnector",
"title": "DataConnector",
"description": "Definition of a data connector, used to bring in sources of data and connect them to OpenDD models and commands.",
"oneOf": [
{
"type": "object",
"required": [
"definition",
"kind",
"version"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"DataConnector"
]
},
"version": {
"type": "string",
"enum": [
"v1"
]
},
"definition": {
"$ref": "#/definitions/DataConnectorV1"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"definition",
"kind",
"version"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"DataConnector"
]
},
"version": {
"type": "string",
"enum": [
"v2"
]
},
"definition": {
"$ref": "#/definitions/DataConnectorV2"
}
},
"additionalProperties": false
}
]
},
{
"$id": "https://hasura.io/jsonschemas/metadata/ObjectType",
"title": "ObjectType",
"description": "Definition of a user-defined Open DD object type.",
"oneOf": [
{
"type": "object",
"required": [
"definition",
"kind",
"version"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"ObjectType"
]
},
"version": {
"type": "string",
"enum": [
"v1"
]
},
"definition": {
"$ref": "#/definitions/ObjectTypeV1"
}
},
"additionalProperties": false
}
]
},
{
"$id": "https://hasura.io/jsonschemas/metadata/ScalarType",
"title": "ScalarType",
"description": "Definition of a user-defined scalar type that that has opaque semantics.",
"oneOf": [
{
"type": "object",
"required": [
"definition",
"kind",
"version"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"ScalarType"
]
},
"version": {
"type": "string",
"enum": [
"v1"
]
},
"definition": {
"$ref": "#/definitions/ScalarTypeV1"
}
},
"additionalProperties": false
}
]
},
{
"$id": "https://hasura.io/jsonschemas/metadata/DataConnectorScalarRepresentation",
"title": "DataConnectorScalarRepresentation",
"description": "The representation of a data connector scalar in terms of Open DD types",
"oneOf": [
{
"type": "object",
"required": [
"definition",
"kind",
"version"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"DataConnectorScalarRepresentation"
]
},
"version": {
"type": "string",
"enum": [
"v1"
]
},
"definition": {
"$ref": "#/definitions/DataConnectorScalarRepresentationV1"
}
},
"additionalProperties": false
}
]
},
{
"$id": "https://hasura.io/jsonschemas/metadata/Model",
"title": "Model",
"description": "The definition of a data model. A data model is a collection of objects of a particular type. Models can support one or more CRUD operations.",
"oneOf": [
{
"type": "object",
"required": [
"definition",
"kind",
"version"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"Model"
]
},
"version": {
"type": "string",
"enum": [
"v1"
]
},
"definition": {
"$ref": "#/definitions/ModelV1"
}
},
"additionalProperties": false
}
]
},
{
"$id": "https://hasura.io/jsonschemas/metadata/Command",
"title": "Command",
"description": "The definition of a command. A command is a user-defined operation which can take arguments and returns an output. The semantics of a command are opaque to the Open DD specification.",
"oneOf": [
{
"type": "object",
"required": [
"definition",
"kind",
"version"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"Command"
]
},
"version": {
"type": "string",
"enum": [
"v1"
]
},
"definition": {
"$ref": "#/definitions/CommandV1"
}
},
"additionalProperties": false
}
]
},
{
"$id": "https://hasura.io/jsonschemas/metadata/Relationship",
"title": "Relationship",
"description": "Definition of a relationship on an OpenDD type which allows it to be extended with related models or commands.",
"oneOf": [
{
"type": "object",
"required": [
"definition",
"kind",
"version"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"Relationship"
]
},
"version": {
"type": "string",
"enum": [
"v1"
]
},
"definition": {
"$ref": "#/definitions/RelationshipV1"
}
},
"additionalProperties": false
}
]
},
{
"$id": "https://hasura.io/jsonschemas/metadata/TypePermissions",
"title": "TypePermissions",
"description": "Definition of permissions for an OpenDD type.",
"oneOf": [
{
"type": "object",
"required": [
"definition",
"kind",
"version"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"TypePermissions"
]
},
"version": {
"type": "string",
"enum": [
"v1"
]
},
"definition": {
"$ref": "#/definitions/TypePermissionsV1"
}
},
"additionalProperties": false
}
]
},
{
"$id": "https://hasura.io/jsonschemas/metadata/ModelPermissions",
"title": "ModelPermissions",
"description": "Definition of permissions for an OpenDD model.",
"oneOf": [
{
"type": "object",
"required": [
"definition",
"kind",
"version"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"ModelPermissions"
]
},
"version": {
"type": "string",
"enum": [
"v1"
]
},
"definition": {
"$ref": "#/definitions/ModelPermissionsV1"
}
},
"additionalProperties": false
}
]
},
{
"$id": "https://hasura.io/jsonschemas/metadata/CommandPermissions",
"title": "CommandPermissions",
"description": "Definition of permissions for an OpenDD command.",
"oneOf": [
{
"type": "object",
"required": [
"definition",
"kind",
"version"
],
"properties": {
"kind": {
"type": "string",
"enum": [
"CommandPermissions"
]
},
"version": {
"type": "string",
"enum": [
"v1"
]
},
"definition": {
"$ref": "#/definitions/CommandPermissionsV1"
}
},
"additionalProperties": false
}
]
}
]
},
"DataConnectorV1": {
"$id": "https://hasura.io/jsonschemas/metadata/DataConnectorV1",
"title": "DataConnectorV1",
"description": "Definition of a data connector - version 1.",
"examples": [
{
"name": "data_connector",
"url": {
"singleUrl": "http://data_connector:8100"
},
"headers": {},
"schema": {
"scalar_types": {},
"object_types": {},
"collections": [],
"functions": [],
"procedures": []
},
"capabilities": {
"versions": "*",
"capabilities": {
"query": {
"variables": {}
}
}
}
}
],
"type": "object",
"required": [
"name",
"url"
],
"properties": {
"name": {
"description": "The name of the data connector.",
"allOf": [
{
"$ref": "#/definitions/DataConnectorName"
}
]
},
"url": {
"description": "The url(s) to access the data connector.",
"allOf": [
{
"$ref": "#/definitions/DataConnectorUrlV1"
}
]
},
"headers": {
"description": "Key value map of HTTP headers to be sent with each request to the data connector.",
"default": {},
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/SecretValue"
}
},
"schema": {
"description": "The schema of the data connector. This schema is used as the source of truth when serving requests and the live schema of the data connector is not looked up.",
"default": {
"scalar_types": {},
"object_types": {},
"collections": [],
"functions": [],
"procedures": []
},
"allOf": [
{
"$ref": "https://raw.githubusercontent.com/hasura/ndc-spec/v0.1.0-rc.11/ndc-client/tests/json_schema/schema_response.jsonschema"
}
]
},
"capabilities": {
"description": "The capabilities of the data connector. This field is required, and is marked optional only for temporary backwards compatibility.",
"anyOf": [
{
"$ref": "#/definitions/CapabilitiesResponse"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
},
"DataConnectorName": {
"description": "The name of a data connector.",
"type": "string"
},
"DataConnectorUrlV1": {
"$id": "https://hasura.io/jsonschemas/metadata/DataConnectorUrlV1",
"title": "DataConnectorUrlV1",
"oneOf": [
{
"type": "object",
"required": [
"singleUrl"
],
"properties": {
"singleUrl": {
"type": "string"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"readWriteUrls"
],
"properties": {
"readWriteUrls": {
"$ref": "#/definitions/ReadWriteUrlsV1"
}
},
"additionalProperties": false
}
]
},
"ReadWriteUrlsV1": {
"$id": "https://hasura.io/jsonschemas/metadata/ReadWriteUrlsV1",
"title": "ReadWriteUrlsV1",
"type": "object",
"required": [
"read",
"write"
],
"properties": {
"read": {
"type": "string"
},
"write": {
"type": "string"
}
},
"additionalProperties": false
},
"SecretValue": {
"$id": "https://hasura.io/jsonschemas/SecretValue",
"title": "SecretValue",
"description": "Either a literal string or a reference to a Hasura secret",
"oneOf": [
{
"type": "object",
"required": [
"value"
],
"properties": {
"value": {
"type": "string"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"stringValueFromSecret"
],
"properties": {
"stringValueFromSecret": {
"type": "string"
}
},
"additionalProperties": false
}
]
},
"CapabilitiesResponse": {
"$ref": "https://raw.githubusercontent.com/hasura/ndc-spec/v0.1.0-rc.11/ndc-client/tests/json_schema/capabilities_response.jsonschema"
},
"DataConnectorV2": {
"$id": "https://hasura.io/jsonschemas/metadata/DataConnectorV2",
"title": "DataConnectorV2",
"description": "Definition of a data connector - version 2.",
"examples": [
{
"name": "data_connector",
"url": {
"singleUrl": {
"value": "http://data_connector:8100"
}
},
"headers": {},
"schema": {
"scalar_types": {},
"object_types": {},
"collections": [],
"functions": [],
"procedures": []
},
"capabilities": {
"versions": "*",
"capabilities": {
"query": {
"variables": {}
}
}
}
}
],
"type": "object",
"required": [
"name",
"url"
],
"properties": {
"name": {
"description": "The name of the data connector.",
"allOf": [
{
"$ref": "#/definitions/DataConnectorName"
}
]
},
"url": {
"description": "The url(s) to access the data connector.",
"allOf": [
{
"$ref": "#/definitions/DataConnectorUrlV2"
}
]
},
"headers": {
"description": "Key value map of HTTP headers to be sent with each request to the data connector.",
"default": {},
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/SecretValue"
}
},
"schema": {
"description": "The schema of the data connector. This schema is used as the source of truth when serving requests and the live schema of the data connector is not looked up.",
"default": {
"scalar_types": {},
"object_types": {},
"collections": [],
"functions": [],
"procedures": []
},
"allOf": [
{
"$ref": "https://raw.githubusercontent.com/hasura/ndc-spec/v0.1.0-rc.11/ndc-client/tests/json_schema/schema_response.jsonschema"
}
]
},
"capabilities": {
"description": "The capabilities of the data connector. This field is required, and is marked optional only for temporary backwards compatibility.",
"anyOf": [
{
"$ref": "#/definitions/CapabilitiesResponse"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
},
"DataConnectorUrlV2": {
"$id": "https://hasura.io/jsonschemas/metadata/DataConnectorUrlV2",
"title": "DataConnectorUrlV2",
"oneOf": [
{
"type": "object",
"required": [
"singleUrl"
],
"properties": {
"singleUrl": {
"$ref": "#/definitions/SecretValue"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"readWriteUrls"
],
"properties": {
"readWriteUrls": {
"$ref": "#/definitions/ReadWriteUrlsV2"
}
},
"additionalProperties": false
}
]
},
"ReadWriteUrlsV2": {
"$id": "https://hasura.io/jsonschemas/metadata/ReadWriteUrlsV2",
"title": "ReadWriteUrlsV2",
"type": "object",
"required": [
"read",
"write"
],
"properties": {
"read": {
"$ref": "#/definitions/SecretValue"
},
"write": {
"$ref": "#/definitions/SecretValue"
}
},
"additionalProperties": false
},
"ObjectTypeV1": {
"$id": "https://hasura.io/jsonschemas/metadata/ObjectTypeV1",
"title": "ObjectTypeV1",
"description": "Definition of a user-defined Open DD object type.",
"examples": [
{
"name": "Author",
"fields": [
{
"name": "author_id",
"type": "Int!"
},
{
"name": "first_name",
"type": "String"
},
{
"name": "last_name",
"type": "String"
}
],
"globalIdFields": [
"author_id"
],
"graphql": {
"typeName": "Author",
"inputTypeName": null
}
}
],
"type": "object",
"required": [
"fields",
"name"
],
"properties": {
"name": {
"description": "The name to give this object type, used to refer to it elsewhere in the metadata. Must be unique across all types defined in this subgraph.",
"allOf": [
{
"$ref": "#/definitions/CustomTypeName"
}
]
},
"fields": {
"description": "The list of fields defined for this object type.",
"type": "array",
"items": {
"$ref": "#/definitions/FieldDefinition"
}
},
"globalIdFields": {
"description": "The subset of fields that uniquely identify this object in the domain. Setting this property will automatically implement the GraphQL Relay Node interface for this object type and add an `id` global ID field. If setting this property, there must not be a field named `id` already present.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/FieldName"
}
},
"graphql": {
"description": "Configuration for how this object type should appear in the GraphQL schema.",
"anyOf": [
{
"$ref": "#/definitions/ObjectTypeGraphQLConfiguration"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
},
"CustomTypeName": {
"description": "The name of a user-defined type.",
"type": "string"
},
"FieldDefinition": {
"$id": "https://hasura.io/jsonschemas/metadata/FieldDefinition",
"title": "ObjectFieldDefinition",
"description": "The definition of a field in a user-defined object type.",
"type": "object",
"required": [
"name",
"type"
],
"properties": {
"name": {
"description": "The name of the field. This name is used both when referring to the field elsewhere in the metadata and when creating the corresponding GraphQl type.",
"allOf": [
{
"$ref": "#/definitions/FieldName"
}
]
},
"type": {
"description": "The type of this field. This uses the GraphQL syntax to represent field types and must refer to one of the inbuilt OpenDd types or another user-defined type.",
"allOf": [
{
"$ref": "#/definitions/TypeReference"
}
]
}
},
"additionalProperties": false
},
"FieldName": {
"description": "The name of a field in a user-defined object type.",
"type": "string"
},
"TypeReference": {
"$id": "https://hasura.io/jsonschemas/metadata/TypeReference",
"title": "TypeReference",
"description": "A reference to an Open DD type including nullable values and arrays.\nSuffix '!' to indicate a non-nullable reference, and wrap in '[]' to indicate an array.\nEg: '[String!]!' is a non-nullable array of non-nullable strings.",
"type": "string"
},
"ObjectTypeGraphQLConfiguration": {
"$id": "https://hasura.io/jsonschemas/metadata/ObjectTypeGraphQLConfiguration",
"title": "ObjectTypeGraphQLConfiguration",
"description": "GraphQL configuration of an Open DD object type.",
"type": "object",
"properties": {
"typeName": {
"description": "The name to use for the GraphQL type representation of this object type when used in an output context.",
"anyOf": [
{
"$ref": "#/definitions/GraphQlTypeName"
},
{
"type": "null"
}
]
},
"inputTypeName": {
"description": "The name to use for the GraphQL type representation of this object type when used in an input context.",
"anyOf": [
{
"$ref": "#/definitions/GraphQlTypeName"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
},
"GraphQlTypeName": {
"type": "string"
},
"ScalarTypeV1": {
"$id": "https://hasura.io/jsonschemas/metadata/ScalarTypeV1",
"title": "ScalarTypeV1",
"description": "Definition of a user-defined scalar type that that has opaque semantics.",
"examples": [
{
"name": "CustomString",
"graphql": {
"typeName": "CustomString"
}
}
],
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"description": "The name to give this scalar type, used to refer to it elsewhere in the metadata. Must be unique across all types defined in this subgraph.",
"allOf": [
{
"$ref": "#/definitions/CustomTypeName"
}
]
},
"graphql": {
"description": "Configuration for how this scalar type should appear in the GraphQL schema.",
"anyOf": [
{
"$ref": "#/definitions/ScalarTypeGraphQLConfiguration"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
},
"ScalarTypeGraphQLConfiguration": {
"$id": "https://hasura.io/jsonschemas/metadata/ScalarTypeGraphQLConfiguration",
"title": "ScalarTypeGraphQLConfiguration",
"description": "GraphQL configuration of an Open DD scalar type",
"type": "object",
"required": [
"typeName"
],
"properties": {
"typeName": {
"description": "The name of the GraphQl type to use for this scalar.",
"allOf": [
{
"$ref": "#/definitions/GraphQlTypeName"
}
]
}
},
"additionalProperties": false
},
"DataConnectorScalarRepresentationV1": {
"$id": "https://hasura.io/jsonschemas/metadata/DataConnectorScalarRepresentationV1",
"title": "DataConnectorScalarRepresentationV1",
"description": "The representation of a data connector scalar in terms of Open DD types",
"examples": [
{
"dataConnectorName": "data_connector",
"dataConnectorScalarType": "varchar",
"representation": "String",
"graphql": {
"comparisonExpressionTypeName": "String_Comparison_Exp"
}
}
],
"type": "object",
"required": [
"dataConnectorName",
"dataConnectorScalarType",
"representation"
],
"properties": {
"dataConnectorName": {
"description": "The name of the data connector that this scalar type comes from.",
"allOf": [
{
"$ref": "#/definitions/DataConnectorName"
}
]
},
"dataConnectorScalarType": {
"description": "The name of the scalar type coming from the data connector.",
"type": "string"
},
"representation": {
"description": "The name of the Open DD type that this data connector scalar type should be represented as.",
"allOf": [
{
"$ref": "#/definitions/TypeName"
}
]
},
"graphql": {
"description": "Configuration for how this scalar's operators should appear in the GraphQL schema.",
"anyOf": [
{
"$ref": "#/definitions/DataConnectorScalarGraphQLConfiguration"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
},
"TypeName": {
"anyOf": [
{
"$ref": "#/definitions/InbuiltType"
},
{
"$ref": "#/definitions/CustomTypeName"
}
]
},
"InbuiltType": {
"$id": "https://hasura.io/jsonschemas/metadata/InbuiltType",
"title": "InbuiltType",
"description": "An inbuilt primitive OpenDD type.",
"type": "string",
"enum": [
"ID",
"Int",
"Float",
"Boolean",
"String"
]
},
"DataConnectorScalarGraphQLConfiguration": {
"$id": "https://hasura.io/jsonschemas/metadata/DataConnectorScalarGraphQLConfiguration",
"title": "DataConnectorScalarGraphQLConfiguration",
"description": "GraphQL configuration of a data connector scalar",
"type": "object",
"properties": {
"comparisonExpressionTypeName": {
"anyOf": [
{
"$ref": "#/definitions/GraphQlTypeName"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
},
"ModelV1": {
"$id": "https://hasura.io/jsonschemas/metadata/ModelV1",
"title": "ModelV1",
"description": "The definition of a data model. A data model is a collection of objects of a particular type. Models can support one or more CRUD operations.",
"examples": [
{
"name": "Articles",
"objectType": "article",
"globalIdSource": true,
"arguments": [],
"source": {
"dataConnectorName": "data_connector",
"collection": "articles",
"typeMapping": {
"article": {
"fieldMapping": {
"article_id": {
"column": "id"
},
"title": {
"column": "title"
},
"author_id": {
"column": "author_id"
}
}
}
},
"argumentMapping": {}
},
"filterableFields": [
{
"fieldName": "article_id",
"operators": {
"enableAll": true
}
},
{
"fieldName": "title",
"operators": {
"enableAll": true
}
},
{
"fieldName": "author_id",
"operators": {
"enableAll": true
}
}
],
"orderableFields": [
{
"fieldName": "article_id",
"orderByDirections": {
"enableAll": true
}
},
{
"fieldName": "title",
"orderByDirections": {
"enableAll": true
}
},
{
"fieldName": "author_id",
"orderByDirections": {
"enableAll": true
}
}
],
"graphql": {
"selectUniques": [
{
"queryRootField": "ArticleByID",
"uniqueIdentifier": [
"article_id"
]
}
],
"selectMany": {
"queryRootField": "ArticleMany"
},
"argumentsInputType": null,
"filterExpressionType": "Article_Where_Exp",
"orderByExpressionType": "Article_Order_By"
}
}
],
"type": "object",
"required": [
"filterableFields",
"name",
"objectType",
"orderableFields"
],
"properties": {
"name": {
"description": "The name of the data model.",
"allOf": [
{
"$ref": "#/definitions/ModelName"
}
]
},
"objectType": {
"description": "The type of the objects of which this model is a collection.",
"allOf": [
{
"$ref": "#/definitions/CustomTypeName"
}
]
},
"globalIdSource": {
"description": "Whether this model should be used as the global ID source for all objects of its type.",
"default": false,
"type": "boolean"
},
"arguments": {
"description": "A list of arguments accepted by this model. Defaults to no arguments.",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/ArgumentDefinition"
}
},
"source": {
"description": "The source configuration for this model.",
"anyOf": [
{
"$ref": "#/definitions/ModelSource"
},
{
"type": "null"
}
]
},
"filterableFields": {
"description": "A list of fields that can be used to filter the objects in this model.",
"type": "array",
"items": {
"$ref": "#/definitions/FilterableField"
}
},
"orderableFields": {
"description": "A list of fields that can be used to order the objects in this model.",
"type": "array",
"items": {
"$ref": "#/definitions/OrderableField"
}
},
"graphql": {
"description": "Configuration for how this model should appear in the GraphQL schema.",
"anyOf": [
{
"$ref": "#/definitions/ModelGraphQlDefinition"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
},
"ModelName": {
"description": "The name of data model.",
"type": "string"
},
"ArgumentDefinition": {
"$id": "https://hasura.io/jsonschemas/metadata/ArgumentDefinition",
"title": "ArgumentDefinition",
"description": "The definition of an argument for a field, command, or model.",
"type": "object",
"required": [
"name",
"type"
],
"properties": {
"name": {
"$ref": "#/definitions/ArgumentName"
},
"type": {
"$ref": "#/definitions/TypeReference"
}
},
"additionalProperties": false
},
"ArgumentName": {
"type": "string"
},
"ModelSource": {
"$id": "https://hasura.io/jsonschemas/metadata/ModelSource",
"title": "ModelSource",
"description": "Description of how a model maps to a particular data connector",
"examples": [
{
"dataConnectorName": "data_connector",
"collection": "articles",
"typeMapping": {
"article": {
"fieldMapping": {
"article_id": {
"column": "id"
},
"title": {
"column": "title"
},
"author_id": {
"column": "author_id"
}
}
}
},
"argumentMapping": {}
}
],
"type": "object",
"required": [
"collection",
"dataConnectorName"
],
"properties": {
"dataConnectorName": {
"description": "The name of the data connector backing this model.",
"allOf": [
{
"$ref": "#/definitions/DataConnectorName"
}
]
},
"collection": {
"description": "The collection in the data connector that backs this model.",
"type": "string"
},
"typeMapping": {
"description": "How the various types used in this model correspond to entities in the data connector.",
"default": {},
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/TypeMapping"
}
},
"argumentMapping": {
"default": {},
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"additionalProperties": false
},
"TypeMapping": {
"$id": "https://hasura.io/jsonschemas/metadata/TypeMapping",
"title": "TypeMapping",
"type": "object",
"required": [
"fieldMapping"
],
"properties": {
"fieldMapping": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/FieldMapping"
}
}
},
"additionalProperties": false
},
"FieldMapping": {
"$id": "https://hasura.io/jsonschemas/metadata/FieldMapping",
"title": "ObjectFieldMapping",
"type": "object",
"required": [
"column"
],
"properties": {
"column": {
"type": "string"
}
},
"additionalProperties": false
},
"FilterableField": {
"$id": "https://hasura.io/jsonschemas/metadata/FilterableField",
"title": "FilterableField",
"type": "object",
"required": [
"fieldName",
"operators"
],
"properties": {
"fieldName": {
"$ref": "#/definitions/FieldName"
},
"operators": {
"$ref": "#/definitions/EnableAllOrSpecific_for_OperatorName"
}
},
"additionalProperties": false
},
"EnableAllOrSpecific_for_OperatorName": {
"$id": "https://hasura.io/jsonschemas/metadata/EnableAllOrSpecific_for_OperatorName",
"title": "EnableAllOrSpecific",
"oneOf": [
{
"type": "object",
"required": [
"enableAll"
],
"properties": {
"enableAll": {
"type": "boolean"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"enableSpecific"
],
"properties": {
"enableSpecific": {
"type": "array",
"items": {
"$ref": "#/definitions/OperatorName"
}
}
},
"additionalProperties": false
}
]
},
"OperatorName": {
"type": "string"
},
"OrderableField": {
"$id": "https://hasura.io/jsonschemas/metadata/OrderableField",
"title": "OrderableField",
"type": "object",
"required": [
"fieldName",
"orderByDirections"
],
"properties": {
"fieldName": {
"$ref": "#/definitions/FieldName"
},
"orderByDirections": {
"$ref": "#/definitions/EnableAllOrSpecific_for_OrderByDirection"
}
},
"additionalProperties": false
},
"EnableAllOrSpecific_for_OrderByDirection": {
"$id": "https://hasura.io/jsonschemas/metadata/EnableAllOrSpecific_for_OrderByDirection",
"title": "EnableAllOrSpecific",
"oneOf": [
{
"type": "object",
"required": [
"enableAll"
],
"properties": {
"enableAll": {
"type": "boolean"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"enableSpecific"
],
"properties": {
"enableSpecific": {
"type": "array",
"items": {
"$ref": "#/definitions/OrderByDirection"
}
}
},
"additionalProperties": false
}
]
},
"OrderByDirection": {
"$id": "https://hasura.io/jsonschemas/metadata/OrderByDirection",
"title": "OrderByDirection",
"type": "string",
"enum": [
"Asc",
"Desc"
]
},
"ModelGraphQlDefinition": {
"$id": "https://hasura.io/jsonschemas/metadata/ModelGraphQlDefinition",
"title": "ModelGraphQlDefinition",
"description": "The definition of how a model appears in the GraphQL API.",
"examples": [
{
"selectUniques": [
{
"queryRootField": "ArticleByID",
"uniqueIdentifier": [
"article_id"
]
}
],
"selectMany": {
"queryRootField": "ArticleMany"
},
"argumentsInputType": null,
"filterExpressionType": "Article_Where_Exp",
"orderByExpressionType": "Article_Order_By"
}
],
"type": "object",
"required": [
"selectUniques"
],
"properties": {
"selectUniques": {
"description": "For each select unique defined here, a query root field is added to the GraphQL API that can be used to select a unique object from the model.",
"type": "array",
"items": {
"$ref": "#/definitions/SelectUniqueGraphQlDefinition"
}
},
"selectMany": {
"description": "Select many configuration for a model adds a query root field to the GraphQl API that can be used to retrieve multiple objects from the model.",
"anyOf": [
{
"$ref": "#/definitions/SelectManyGraphQlDefinition"
},
{
"type": "null"
}
]
},
"argumentsInputType": {
"description": "The type name of the input type used to hold the arguments of the model.",
"anyOf": [
{
"$ref": "#/definitions/GraphQlTypeName"
},
{
"type": "null"
}
]
},
"filterExpressionType": {
"description": "The type name of the filter boolean expression input type.",
"anyOf": [
{
"$ref": "#/definitions/GraphQlTypeName"
},
{
"type": "null"
}
]
},
"orderByExpressionType": {
"description": "The type name of the order by expression input type.",
"anyOf": [
{
"$ref": "#/definitions/GraphQlTypeName"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
},
"SelectUniqueGraphQlDefinition": {
"$id": "https://hasura.io/jsonschemas/metadata/SelectUniqueGraphQlDefinition",
"title": "SelectUniqueGraphQlDefinition",
"description": "The definition of the GraphQL API for selecting a unique row/object from a model.",
"type": "object",
"required": [
"queryRootField",
"uniqueIdentifier"
],
"properties": {
"queryRootField": {
"description": "The name of the query root field for this API.",
"allOf": [
{
"$ref": "#/definitions/GraphQlFieldName"
}
]
},
"uniqueIdentifier": {
"description": "A set of fields which can uniquely identify a row/object in the model.",
"type": "array",
"items": {
"$ref": "#/definitions/FieldName"
}
}
},
"additionalProperties": false
},
"GraphQlFieldName": {
"description": "The name of a GraphQL object field.",
"type": "string"
},
"SelectManyGraphQlDefinition": {
"$id": "https://hasura.io/jsonschemas/metadata/SelectManyGraphQlDefinition",
"title": "SelectManyGraphQlDefinition",
"description": "The definition of the GraphQL API for selecting rows from a model.",
"type": "object",
"required": [
"queryRootField"
],
"properties": {
"queryRootField": {
"description": "The name of the query root field for this API.",
"allOf": [
{
"$ref": "#/definitions/GraphQlFieldName"
}
]
}
},
"additionalProperties": false
},
"CommandV1": {
"$id": "https://hasura.io/jsonschemas/metadata/CommandV1",
"title": "CommandV1",
"description": "Definition of an OpenDD Command, which is a custom operation that can take arguments and returns an output. The semantics of a command are opaque to OpenDD.",
"examples": [
{
"name": "get_latest_article",
"outputType": "commandArticle",
"arguments": [],
"source": {
"dataConnectorName": "data_connector",
"dataConnectorCommand": {
"function": "latest_article"
},
"typeMapping": {
"commandArticle": {
"fieldMapping": {
"article_id": {
"column": "id"
}
}
}
},
"argumentMapping": {}
},
"graphql": {
"rootFieldName": "getLatestArticle",
"rootFieldKind": "Query"
}
}
],
"type": "object",
"required": [
"name",
"outputType"
],
"properties": {
"name": {
"description": "The name of the command.",
"allOf": [
{
"$ref": "#/definitions/CommandName"
}
]
},
"outputType": {
"description": "The return type of the command.",
"allOf": [
{
"$ref": "#/definitions/TypeReference"
}
]
},
"arguments": {
"description": "The list of arguments accepted by this command. Defaults to no arguments.",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/ArgumentDefinition"
}
},
"source": {
"description": "The source configuration for this command.",
"anyOf": [
{
"$ref": "#/definitions/CommandSource"
},
{
"type": "null"
}
]
},
"graphql": {
"description": "Configuration for how this command should appear in the GraphQL schema.",
"anyOf": [
{
"$ref": "#/definitions/CommandGraphQlDefinition"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
},
"CommandName": {
"description": "The name of a command.",
"type": "string"
},
"CommandSource": {
"$id": "https://hasura.io/jsonschemas/metadata/CommandSource",
"title": "CommandSource",
"description": "Description of how a command maps to a particular data connector",
"examples": [
{
"dataConnectorName": "data_connector",
"dataConnectorCommand": {
"function": "latest_article"
},
"typeMapping": {},
"argumentMapping": {}
}
],
"type": "object",
"required": [
"dataConnectorCommand",
"dataConnectorName"
],
"properties": {
"dataConnectorName": {
"description": "The name of the data connector backing this command.",
"allOf": [
{
"$ref": "#/definitions/DataConnectorName"
}
]
},
"dataConnectorCommand": {
"description": "The function/procedure in the data connector that backs this command.",
"allOf": [
{
"$ref": "#/definitions/DataConnectorCommand"
}
]
},
"typeMapping": {
"description": "How the various types used in this command correspond to entities in the data connector.",
"default": {},
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/TypeMapping"
}
},
"argumentMapping": {
"description": "Mapping from command argument names to data connector table argument names.",
"default": {},
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"additionalProperties": false
},
"DataConnectorCommand": {
"$id": "https://hasura.io/jsonschemas/metadata/DataConnectorCommand",
"title": "DataConnectorCommand",
"oneOf": [
{
"title": "Function",
"type": "object",
"required": [
"function"
],
"properties": {
"function": {
"$ref": "#/definitions/FunctionName"
}
},
"additionalProperties": false
},
{
"title": "Procedure",
"type": "object",
"required": [
"procedure"
],
"properties": {
"procedure": {
"$ref": "#/definitions/ProcedureName"
}
},
"additionalProperties": false
}
]
},
"FunctionName": {
"description": "The name of a function backing the command.",
"type": "string"
},
"ProcedureName": {
"description": "The name of a procedure backing the command.",
"type": "string"
},
"CommandGraphQlDefinition": {
"$id": "https://hasura.io/jsonschemas/metadata/CommandGraphQlDefinition",
"title": "CommandGraphQlDefinition",
"description": "The definition of how a command should appear in the GraphQL API.",
"examples": [
{
"rootFieldName": "getLatestArticle",
"rootFieldKind": "Query"
}
],
"type": "object",
"required": [
"rootFieldKind",
"rootFieldName"
],
"properties": {
"rootFieldName": {
"description": "The name of the graphql root field to use for this command.",
"allOf": [
{
"$ref": "#/definitions/GraphQlFieldName"
}
]
},
"rootFieldKind": {
"description": "Whether to put this command in the Query or Mutation root of the GraphQL API.",
"allOf": [
{
"$ref": "#/definitions/GraphQlRootFieldKind"
}
]
}
},
"additionalProperties": false
},
"GraphQlRootFieldKind": {
"$id": "https://hasura.io/jsonschemas/metadata/GraphQlRootFieldKind",
"title": "GraphQlRootFieldKind",
"type": "string",
"enum": [
"Query",
"Mutation"
]
},
"RelationshipV1": {
"$id": "https://hasura.io/jsonschemas/metadata/RelationshipV1",
"title": "RelationshipV1",
"description": "Definition of a relationship on an OpenDD type which allows it to be extended with related models or commands.",
"examples": [
{
"name": "Articles",
"source": "author",
"target": {
"model": {
"name": "Articles",
"namespace": null,
"subgraph": null,
"relationshipType": "Array"
}
},
"mapping": [
{
"source": {
"fieldPath": [
{
"fieldName": "author_id"
}
]
},
"target": {
"modelField": [
{
"fieldName": "author_id"
}
]
}
}
]
}
],
"type": "object",
"required": [
"mapping",
"name",
"source",
"target"
],
"properties": {
"name": {
"description": "The name of the relationship.",
"allOf": [
{
"$ref": "#/definitions/RelationshipName"
}
]
},
"source": {
"description": "The source type of the relationship.",
"allOf": [
{
"$ref": "#/definitions/CustomTypeName"
}
]
},
"target": {
"description": "The target of the relationship.",
"allOf": [
{
"$ref": "#/definitions/RelationshipTarget"
}
]
},
"mapping": {
"description": "The mapping configuration of source to target for the relationship.",
"type": "array",
"items": {
"$ref": "#/definitions/RelationshipMapping"
}
}
},
"additionalProperties": false
},
"RelationshipName": {
"description": "The name of the GraphQL relationship field.",
"type": "string"
},
"RelationshipTarget": {
"$id": "https://hasura.io/jsonschemas/metadata/RelationshipTarget",
"title": "RelationshipTarget",
"description": "The target for a relationship.",
"examples": [
{
"model": {
"name": "Articles",
"namespace": null,
"subgraph": null,
"relationshipType": "Array"
}
}
],
"oneOf": [
{
"type": "object",
"required": [
"model"
],
"properties": {
"model": {
"$ref": "#/definitions/ModelRelationshipTarget"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"command"
],
"properties": {
"command": {
"$ref": "#/definitions/CommandRelationshipTarget"
}
},
"additionalProperties": false
}
]
},
"ModelRelationshipTarget": {
"$id": "https://hasura.io/jsonschemas/metadata/ModelRelationshipTarget",
"title": "ModelRelationshipTarget",
"description": "The target model for a relationship.",
"type": "object",
"required": [
"name",
"relationshipType"
],
"properties": {
"name": {
"description": "The name of the data model.",
"allOf": [
{
"$ref": "#/definitions/ModelName"
}
]
},
"namespace": {
"type": [
"string",
"null"
]
},
"subgraph": {
"description": "The subgraph of the target model. Defaults to the current subgraph.",
"type": [
"string",
"null"
]
},
"relationshipType": {
"description": "Type of the relationship - object or array.",
"allOf": [
{
"$ref": "#/definitions/RelationshipType"
}
]
}
},
"additionalProperties": false
},
"RelationshipType": {
"$id": "https://hasura.io/jsonschemas/metadata/RelationshipType",
"title": "RelationshipType",
"description": "Type of the relationship.",
"oneOf": [
{
"description": "Select one related object from the target.",
"type": "string",
"enum": [
"Object"
]
},
{
"description": "Select multiple related objects from the target.",
"type": "string",
"enum": [
"Array"
]
}
]
},
"CommandRelationshipTarget": {
"$id": "https://hasura.io/jsonschemas/metadata/CommandRelationshipTarget",
"title": "CommandRelationshipTarget",
"description": "The target command for a relationship.",
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"description": "The name of the command.",
"allOf": [
{
"$ref": "#/definitions/CommandName"
}
]
},
"subgraph": {
"description": "The subgraph of the target command. Defaults to the current subgraph.",
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"RelationshipMapping": {
"$id": "https://hasura.io/jsonschemas/metadata/RelationshipMapping",
"title": "RelationshipMapping",
"description": "Definition of a how a particular field in the source maps to a target field or argument.",
"examples": [
{
"source": {
"fieldPath": [
{
"fieldName": "author_id"
}
]
},
"target": {
"modelField": [
{
"fieldName": "author_id"
}
]
}
}
],
"type": "object",
"required": [
"source",
"target"
],
"properties": {
"source": {
"description": "The source configuration for this relationship mapping.",
"allOf": [
{
"$ref": "#/definitions/RelationshipMappingSource"
}
]
},
"target": {
"description": "The target configuration for this relationship mapping.",
"allOf": [
{
"$ref": "#/definitions/RelationshipMappingTarget"
}
]
}
},
"additionalProperties": false
},
"RelationshipMappingSource": {
"$id": "https://hasura.io/jsonschemas/metadata/RelationshipMappingSource",
"title": "RelationshipMappingSource",
"description": "The source configuration for a relationship mapping.",
"oneOf": [
{
"title": "SourceValue",
"type": "object",
"required": [
"value"
],
"properties": {
"value": {
"$ref": "#/definitions/ValueExpression"
}
},
"additionalProperties": false
},
{
"title": "SourceField",
"type": "object",
"required": [
"fieldPath"
],
"properties": {
"fieldPath": {
"type": "array",
"items": {
"$ref": "#/definitions/FieldAccess"
}
}
},
"additionalProperties": false
}
]
},
"ValueExpression": {
"$id": "https://hasura.io/jsonschemas/metadata/ValueExpression",
"title": "ValueExpression",
"description": "An expression which evaluates to a value that can be used in permissions.",
"oneOf": [
{
"title": "Literal",
"type": "object",
"required": [
"literal"
],
"properties": {
"literal": true
},
"additionalProperties": false
},
{
"title": "SessionVariable",
"type": "object",
"required": [
"sessionVariable"
],
"properties": {
"sessionVariable": {
"$ref": "#/definitions/OpenDdSessionVariable"
}
},
"additionalProperties": false
}
]
},
"OpenDdSessionVariable": {
"description": "Used to represent the name of a session variable, like \"x-hasura-role\".",
"type": "string"
},
"FieldAccess": {
"$id": "https://hasura.io/jsonschemas/metadata/FieldAccess",
"title": "RelationshipSourceFieldAccess",
"type": "object",
"required": [
"fieldName"
],
"properties": {
"fieldName": {
"$ref": "#/definitions/FieldName"
}
},
"additionalProperties": false
},
"RelationshipMappingTarget": {
"$id": "https://hasura.io/jsonschemas/metadata/RelationshipMappingTarget",
"title": "RelationshipMappingTarget",
"description": "The target configuration for a relationship mapping.",
"oneOf": [
{
"title": "TargetArgument",
"type": "object",
"required": [
"argument"
],
"properties": {
"argument": {
"$ref": "#/definitions/ArgumentMappingTarget"
}
},
"additionalProperties": false
},
{
"title": "TargetModelField",
"type": "object",
"required": [
"modelField"
],
"properties": {
"modelField": {
"type": "array",
"items": {
"$ref": "#/definitions/FieldAccess"
}
}
},
"additionalProperties": false
}
]
},
"ArgumentMappingTarget": {
"$id": "https://hasura.io/jsonschemas/metadata/ArgumentMappingTarget",
"title": "ArgumentMappingTarget",
"type": "object",
"required": [
"argumentName"
],
"properties": {
"argumentName": {
"$ref": "#/definitions/ArgumentName"
}
},
"additionalProperties": false
},
"TypePermissionsV1": {
"$id": "https://hasura.io/jsonschemas/metadata/TypePermissionsV1",
"title": "TypePermissionsV1",
"description": "Definition of permissions for an OpenDD type.",
"examples": [
{
"typeName": "article",
"permissions": [
{
"role": "admin",
"output": {
"allowedFields": [
"article_id",
"author_id",
"title"
]
}
},
{
"role": "user",
"output": {
"allowedFields": [
"article_id",
"author_id"
]
}
}
]
}
],
"type": "object",
"required": [
"permissions",
"typeName"
],
"properties": {
"typeName": {
"description": "The name of the type for which permissions are being defined. Must be an object type.",
"allOf": [
{
"$ref": "#/definitions/CustomTypeName"
}
]
},
"permissions": {
"description": "A list of type permissions, one for each role.",
"type": "array",
"items": {
"$ref": "#/definitions/TypePermission"
}
}
},
"additionalProperties": false
},
"TypePermission": {
"$id": "https://hasura.io/jsonschemas/metadata/TypePermission",
"title": "TypePermission",
"description": "Defines permissions for a particular role for a type.",
"examples": [
{
"role": "user",
"output": {
"allowedFields": [
"article_id",
"author_id"
]
}
}
],
"type": "object",
"required": [
"role"
],
"properties": {
"role": {
"description": "The role for which permissions are being defined.",
"allOf": [
{
"$ref": "#/definitions/Role"
}
]
},
"output": {
"description": "Permissions for this role when this type is used in an output context. If null, this type is inaccessible for this role in an output context.",
"anyOf": [
{
"$ref": "#/definitions/TypeOutputPermission"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
},
"Role": {
"type": "string"
},
"TypeOutputPermission": {
"$id": "https://hasura.io/jsonschemas/metadata/TypeOutputPermission",
"title": "TypeOutputPermission",
"description": "Permissions for a type for a particular role when used in an output context.",
"type": "object",
"required": [
"allowedFields"
],
"properties": {
"allowedFields": {
"description": "Fields of the type that are accessible for a role",
"type": "array",
"items": {
"$ref": "#/definitions/FieldName"
},
"uniqueItems": true
}
},
"additionalProperties": false
},
"ModelPermissionsV1": {
"$id": "https://hasura.io/jsonschemas/metadata/ModelPermissionsV1",
"title": "ModelPermissionsV1",
"description": "Definition of permissions for an OpenDD model.",
"examples": [
{
"modelName": "Articles",
"permissions": [
{
"role": "admin",
"select": {
"filter": null
}
},
{
"role": "user",
"select": {
"filter": {
"fieldComparison": {
"field": "author_id",
"operator": "_eq",
"value": {
"sessionVariable": "x-hasura-user-id"
}
}
}
}
}
]
}
],
"type": "object",
"required": [
"modelName",
"permissions"
],
"properties": {
"modelName": {
"description": "The name of the model for which permissions are being defined.",
"allOf": [
{
"$ref": "#/definitions/ModelName"
}
]
},
"permissions": {
"description": "A list of model permissions, one for each role.",
"type": "array",
"items": {
"$ref": "#/definitions/ModelPermission"
}
}
},
"additionalProperties": false
},
"ModelPermission": {
"$id": "https://hasura.io/jsonschemas/metadata/ModelPermission",
"title": "ModelPermission",
"description": "Defines the permissions for an OpenDD model.",
"examples": [
{
"role": "user",
"select": {
"filter": {
"fieldComparison": {
"field": "author_id",
"operator": "_eq",
"value": {
"sessionVariable": "x-hasura-user-id"
}
}
}
}
}
],
"type": "object",
"required": [
"role"
],
"properties": {
"role": {
"description": "The role for which permissions are being defined.",
"allOf": [
{
"$ref": "#/definitions/Role"
}
]
},
"select": {
"description": "The permissions for selecting from this model for this role. If this is null, the role is not allowed to query the model.",
"anyOf": [
{
"$ref": "#/definitions/SelectPermission"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
},
"SelectPermission": {
"$id": "https://hasura.io/jsonschemas/metadata/SelectPermission",
"title": "SelectPermission",
"description": "Defines the permissions for selecting a model for a role.",
"type": "object",
"required": [
"filter"
],
"properties": {
"filter": {
"description": "Filter expression when selecting rows for this model. Null filter implies all rows are selectable.",
"allOf": [
{
"$ref": "#/definitions/NullableModelPredicate"
}
]
}
},
"additionalProperties": false
},
"NullableModelPredicate": {
"anyOf": [
{
"type": "null"
},
{
"$ref": "#/definitions/ModelPredicate"
}
]
},
"ModelPredicate": {
"$id": "https://hasura.io/jsonschemas/metadata/ModelPredicate",
"title": "ModelPredicate",
"description": "A predicate that can be used to restrict the objects returned when querying a model.",
"examples": [
{
"fieldComparison": {
"field": "author_id",
"operator": "_eq",
"value": {
"sessionVariable": "x-hasura-user-id"
}
}
}
],
"oneOf": [
{
"description": "Filters objects based on a field value.",
"type": "object",
"required": [
"fieldComparison"
],
"properties": {
"fieldComparison": {
"$ref": "#/definitions/FieldComparisonPredicate"
}
},
"additionalProperties": false
},
{
"description": "Filters objects based on the relationship of a model.",
"type": "object",
"required": [
"relationship"
],
"properties": {
"relationship": {
"$ref": "#/definitions/RelationshipPredicate"
}
},
"additionalProperties": false
},
{
"title": "And",
"description": "Evaluates to true if all sub-predicates evaluate to true.",
"type": "object",
"required": [
"and"
],
"properties": {
"and": {
"type": "array",
"items": {
"$ref": "#/definitions/ModelPredicate"
}
}
},
"additionalProperties": false
},
{
"title": "Or",
"description": "Evaluates to true if any of the sub-predicates evaluate to true.",
"type": "object",
"required": [
"or"
],
"properties": {
"or": {
"type": "array",
"items": {
"$ref": "#/definitions/ModelPredicate"
}
}
},
"additionalProperties": false
},
{
"title": "Not",
"description": "Evaluates to true if the sub-predicate evaluates to false.",
"type": "object",
"required": [
"not"
],
"properties": {
"not": {
"$ref": "#/definitions/ModelPredicate"
}
},
"additionalProperties": false
}
]
},
"FieldComparisonPredicate": {
"$id": "https://hasura.io/jsonschemas/metadata/FieldComparisonPredicate",
"title": "FieldComparisonPredicate",
"description": "Field comparision predicate filters objects based on a field value.",
"type": "object",
"required": [
"field",
"operator"
],
"properties": {
"field": {
"description": "The field name of the object type of the model to compare.",
"allOf": [
{
"$ref": "#/definitions/FieldName"
}
]
},
"operator": {
"description": "The name of the operator to use for comparison.",
"allOf": [
{
"$ref": "#/definitions/OperatorName"
}
]
},
"value": {
"description": "The value expression to compare against.",
"anyOf": [
{
"$ref": "#/definitions/ValueExpression"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
},
"RelationshipPredicate": {
"$id": "https://hasura.io/jsonschemas/metadata/RelationshipPredicate",
"title": "RelationshipPredicate",
"description": "Relationship predicate filters objects of a source model based on a predicate on the related model.",
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"description": "The name of the relationship of the object type of the model to follow.",
"allOf": [
{
"$ref": "#/definitions/RelationshipName"
}
]
},
"predicate": {
"description": "The predicate to apply on the related objects. If this is null, then the predicate evaluates to true as long as there is at least one related object present.",
"anyOf": [
{
"$ref": "#/definitions/ModelPredicate"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
},
"CommandPermissionsV1": {
"$id": "https://hasura.io/jsonschemas/metadata/CommandPermissionsV1",
"title": "CommandPermissionsV1",
"description": "Definition of permissions for an OpenDD command.",
"examples": [
{
"commandName": "get_article_by_id",
"permissions": [
{
"role": "admin",
"allowExecution": true
},
{
"role": "user",
"allowExecution": true
}
]
}
],
"type": "object",
"required": [
"commandName",
"permissions"
],
"properties": {
"commandName": {
"description": "The name of the command for which permissions are being defined.",
"allOf": [
{
"$ref": "#/definitions/CommandName"
}
]
},
"permissions": {
"description": "A list of command permissions, one for each role.",
"type": "array",
"items": {
"$ref": "#/definitions/CommandPermission"
}
}
},
"additionalProperties": false
},
"CommandPermission": {
"$id": "https://hasura.io/jsonschemas/metadata/CommandPermission",
"title": "CommandPermission",
"description": "Defines the permissions for a role for a command.",
"examples": [
{
"role": "user",
"allowExecution": true
}
],
"type": "object",
"required": [
"allowExecution",
"role"
],
"properties": {
"role": {
"description": "The role for which permissions are being defined.",
"allOf": [
{
"$ref": "#/definitions/Role"
}
]
},
"allowExecution": {
"description": "Whether the command is executable by the role.",
"type": "boolean"
}
},
"additionalProperties": false
},
"OpenDdMetadataWithVersion": {
"oneOf": [
{
"type": "object",
"required": [
"namespaces",
"version"
],
"properties": {
"version": {
"type": "string",
"enum": [
"v1"
]
},
"namespaces": {
"type": "array",
"items": {
"$ref": "#/definitions/NamespacedObjects"
}
},
"flags": {
"default": {
"require_ndc_capabilities": false
},
"allOf": [
{
"$ref": "#/definitions/OpenDdFlags"
}
]
}
}
},
{
"type": "object",
"required": [
"version"
],
"properties": {
"version": {
"type": "string",
"enum": [
"v2"
]
},
"supergraph": {
"default": {
"objects": []
},
"allOf": [
{
"$ref": "#/definitions/OpenDdSupergraph"
}
]
},
"subgraphs": {
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/OpenDdSubgraph"
}
},
"flags": {
"default": {
"require_ndc_capabilities": false
},
"allOf": [
{
"$ref": "#/definitions/OpenDdFlags"
}
]
}
}
}
]
},
"NamespacedObjects": {
"type": "object",
"required": [
"name",
"objects"
],
"properties": {
"name": {
"type": "string"
},
"objects": {
"type": "array",
"items": {
"$ref": "#/definitions/OpenDdSubgraphObject"
}
}
}
},
"OpenDdFlags": {
"type": "object",
"properties": {
"require_ndc_capabilities": {
"default": false,
"type": "boolean"
}
}
},
"OpenDdSupergraph": {
"type": "object",
"properties": {
"objects": {
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/OpenDdSupergraphObject"
}
}
}
},
"OpenDdSupergraphObject": {
"type": "string",
"enum": []
},
"OpenDdSubgraph": {
"type": "object",
"required": [
"name",
"objects"
],
"properties": {
"name": {
"type": "string"
},
"objects": {
"type": "array",
"items": {
"$ref": "#/definitions/OpenDdSubgraphObject"
}
}
}
}
}
}