Skip to content
Draft
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
7 changes: 7 additions & 0 deletions app/graphql/types/base_input_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ module Types
class BaseInputObject < GraphQL::Schema::InputObject
argument_class Types::BaseArgument

def self.inherited(subclass)
super
return if subclass.name.blank?

subclass.graphql_name subclass.name.delete_prefix('Types::Input::').gsub('::', '').delete_suffix('Type')
end

def self.require_one_of(arguments)
validates required: { one_of: arguments, message: "Only one of #{arguments.inspect} should be provided" }
end
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/types/data_type_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class DataTypeType < Types::BaseObject
field :display_messages, [Types::TranslationType], null: true,
description: 'Display message of the function'
field :generic_keys, [String], null: true, description: 'Generic keys of the datatype'
field :identifier, String, null: false, description: 'The identifier scoped to the namespace'
field :identifier, String, null: false, description: 'The identifier of the datatype'
field :name, [Types::TranslationType], method: :names, null: false,
description: 'Names of the flow type setting'
field :rules, Types::DataTypeRuleType.connection_type, null: false,
Expand Down
17 changes: 10 additions & 7 deletions app/graphql/types/input/data_type_identifier_input_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
module Types
module Input
class DataTypeIdentifierInputType < Types::BaseInputObject
description 'Input type for data type identifier'
description 'Input for creation of a new DataTypeIdentifier'

argument :data_type_id, Types::GlobalIdType[::DataType], required: false,
description: 'Data type ID'
argument :generic_key, String, required: false,
description: 'Generic key value'
argument :generic_type, Types::Input::GenericTypeInputType, required: false,
description: 'Generic type information'
argument :data_type, Types::Input::DataTypeInputType,
required: false,
description: 'Data type'
argument :generic_key, String,
required: false,
description: 'Generic key value'
argument :generic_type, Types::Input::GenericTypeInputType,
required: false,
description: 'Generic type information'
end
end
end
31 changes: 31 additions & 0 deletions app/graphql/types/input/data_type_input_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# frozen_string_literal: true

module Types
module Input
class DataTypeInputType < Types::BaseInputObject
description 'Input for creation of a data type'

argument :aliases, [Types::Input::TranslationInputType],
required: false,
description: 'Name of the function'
argument :display_messages, [Types::Input::TranslationInputType],
required: false,
description: 'Display message of the function'
argument :generic_keys, [String],
required: false,
description: 'Generic keys of the datatype'
argument :identifier, String,
required: true,
description: 'The identifier of the datatype'
argument :name, [Types::Input::TranslationInputType],
required: true,
description: 'Names of the flow type setting'
argument :rules, [Types::Input::DataTypeRuleInputType],
required: true,
description: 'Rules of the datatype'
argument :variant, Types::DataTypeVariantEnum,
required: true,
description: 'The type of the datatype'
end
end
end
48 changes: 48 additions & 0 deletions app/graphql/types/input/data_type_rule_config_input_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# frozen_string_literal: true

module Types
module Input
class DataTypeRuleConfigInputType < Types::BaseInputObject
description 'Input type for the config of a data type rule'

# contains key
# contains type
# return type
# parent type
argument :data_type_identifier, Types::Input::DataTypeIdentifierInputType,
required: false,
description: 'Data type identifier'

# contains key
argument :key, String,
required: false,
description: 'The key of the rule'

# number range
argument :from, Integer,
required: false,
description: 'The minimum value of the range'
argument :steps, Integer,
required: false,
description: 'The step value for the range, if applicable'
argument :to, Integer,
required: false,
description: 'The maximum value of the range'

# item of collection
argument :items, [GraphQL::Types::JSON],
required: false,
description: 'The items of the rule'

# regex
argument :pattern, String,
required: false,
description: 'The regex pattern to match against the data type value.'

# input types
argument :input_types, [Types::Input::DataTypeRuleInputTypeConfigInputType],
required: false,
description: 'The input types that can be used in this data type rule'
end
end
end
17 changes: 17 additions & 0 deletions app/graphql/types/input/data_type_rule_input_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

module Types
module Input
class DataTypeRuleInputType < Types::BaseInputObject
description 'Input for creation of a new DataTypeRule'

argument :variant, Types::DataTypeRules::VariantEnum,
required: true,
description: 'The type of the rule'

argument :config, Types::Input::DataTypeRuleConfigInputType,
required: true,
description: 'The config of the rule'
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

module Types
module Input
class DataTypeRuleInputTypeConfigInputType < Types::BaseInputObject
description 'Input type for the config of a data type rule'

argument :data_type_identifier, Types::Input::DataTypeIdentifierInputType,
required: true,
description: 'Data type identifier'

argument :input_identifier, String,
required: true,
description: 'The input identifier that this configuration applies to'
end
end
end
8 changes: 8 additions & 0 deletions app/graphql/types/input/flow_input_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ class FlowInputType < Types::BaseInputObject

argument :type, Types::GlobalIdType[::FlowType], required: true,
description: 'The identifier of the flow type'

argument :input_type, Types::Input::DataTypeIdentifierInputType,
required: false,
description: 'The input data type'

argument :return_type, Types::Input::DataTypeIdentifierInputType,
required: false,
description: 'The return data type'
end
end
end
6 changes: 4 additions & 2 deletions app/graphql/types/input/generic_mapper_input_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ class GenericMapperInputType < Types::BaseInputObject
description 'Input type for generic mappers'

argument :source_data_type_identifiers, [Types::Input::DataTypeIdentifierInputType],
required: true, description: 'The source data type identifier for the mapper'
required: true,
description: 'The source data type identifier for the mapper'

argument :target, String,
required: true, description: 'The target data type identifier for the mapper'
required: true,
description: 'The target data type identifier for the mapper'
end
end
end
8 changes: 5 additions & 3 deletions app/graphql/types/input/generic_type_input_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ module Input
class GenericTypeInputType < Types::BaseInputObject
description 'Input type for generic type operations.'

argument :data_type_id, Types::GlobalIdType[::DataType],
required: true, description: 'The data type associated with this generic type.'
argument :data_type_id, Types::Input::DataTypeInputType,
required: true,
description: 'The data type associated with this generic type.'
argument :generic_mappers, [Types::Input::GenericMapperInputType],
required: true, description: 'The mappers associated with this generic type.'
required: true,
description: 'The mappers associated with this generic type.'
end
end
end
16 changes: 16 additions & 0 deletions app/graphql/types/input/translation_input_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

module Types
module Input
class TranslationInputType < Types::BaseInputObject
description 'Represents a translation'

argument :code, String,
required: true,
description: 'Code of the translation'
argument :content, String,
required: true,
description: 'Content of the translation'
end
end
end
13 changes: 13 additions & 0 deletions docs/graphql/input_object/datatypeidentifierinput.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: DataTypeIdentifierInput
---

Input for creation of a new DataTypeIdentifier

## Fields

| Name | Type | Description |
|------|------|-------------|
| `dataType` | [`DataTypeInput`](../input_object/datatypeinput.md) | Data type |
| `genericKey` | [`String`](../scalar/string.md) | Generic key value |
| `genericType` | [`GenericTypeInput`](../input_object/generictypeinput.md) | Generic type information |
17 changes: 17 additions & 0 deletions docs/graphql/input_object/datatypeinput.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: DataTypeInput
---

Input for creation of a data type

## Fields

| Name | Type | Description |
|------|------|-------------|
| `aliases` | [`[TranslationInput!]`](../input_object/translationinput.md) | Name of the function |
| `displayMessages` | [`[TranslationInput!]`](../input_object/translationinput.md) | Display message of the function |
| `genericKeys` | [`[String!]`](../scalar/string.md) | Generic keys of the datatype |
| `identifier` | [`String!`](../scalar/string.md) | The identifier of the datatype |
| `name` | [`[TranslationInput!]!`](../input_object/translationinput.md) | Names of the flow type setting |
| `rules` | [`[DataTypeRuleInput!]!`](../input_object/datatyperuleinput.md) | Rules of the datatype |
| `variant` | [`DataTypeVariant!`](../enum/datatypevariant.md) | The type of the datatype |
18 changes: 18 additions & 0 deletions docs/graphql/input_object/datatyperuleconfiginput.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: DataTypeRuleConfigInput
---

Input type for the config of a data type rule

## Fields

| Name | Type | Description |
|------|------|-------------|
| `dataTypeIdentifier` | [`DataTypeIdentifierInput`](../input_object/datatypeidentifierinput.md) | Data type identifier |
| `from` | [`Int`](../scalar/int.md) | The minimum value of the range |
| `inputTypes` | [`[DataTypeRuleInputTypeConfigInput!]`](../input_object/datatyperuleinputtypeconfiginput.md) | The input types that can be used in this data type rule |
| `items` | [`[JSON!]`](../scalar/json.md) | The items of the rule |
| `key` | [`String`](../scalar/string.md) | The key of the rule |
| `pattern` | [`String`](../scalar/string.md) | The regex pattern to match against the data type value. |
| `steps` | [`Int`](../scalar/int.md) | The step value for the range, if applicable |
| `to` | [`Int`](../scalar/int.md) | The maximum value of the range |
12 changes: 12 additions & 0 deletions docs/graphql/input_object/datatyperuleinput.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: DataTypeRuleInput
---

Input for creation of a new DataTypeRule

## Fields

| Name | Type | Description |
|------|------|-------------|
| `config` | [`DataTypeRuleConfigInput!`](../input_object/datatyperuleconfiginput.md) | The config of the rule |
| `variant` | [`DataTypeRulesVariant!`](../enum/datatyperulesvariant.md) | The type of the rule |
12 changes: 12 additions & 0 deletions docs/graphql/input_object/datatyperuleinputtypeconfiginput.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: DataTypeRuleInputTypeConfigInput
---

Input type for the config of a data type rule

## Fields

| Name | Type | Description |
|------|------|-------------|
| `dataTypeIdentifier` | [`DataTypeIdentifierInput!`](../input_object/datatypeidentifierinput.md) | Data type identifier |
| `inputIdentifier` | [`String!`](../scalar/string.md) | The input identifier that this configuration applies to |
2 changes: 2 additions & 0 deletions docs/graphql/input_object/flowinput.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ Input type for creating or updating a flow

| Name | Type | Description |
|------|------|-------------|
| `inputType` | [`DataTypeIdentifierInput`](../input_object/datatypeidentifierinput.md) | The input data type |
| `name` | [`String!`](../scalar/string.md) | The name of the flow |
| `nodes` | [`[NodeFunctionInput!]!`](../input_object/nodefunctioninput.md) | The node functions of the flow |
| `returnType` | [`DataTypeIdentifierInput`](../input_object/datatypeidentifierinput.md) | The return data type |
| `settings` | [`[FlowSettingInput!]`](../input_object/flowsettinginput.md) | The settings of the flow |
| `startingNodeId` | [`NodeFunctionID`](../scalar/nodefunctionid.md) | The starting node of the flow |
| `type` | [`FlowTypeID!`](../scalar/flowtypeid.md) | The identifier of the flow type |
12 changes: 12 additions & 0 deletions docs/graphql/input_object/genericmapperinput.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: GenericMapperInput
---

Input type for generic mappers

## Fields

| Name | Type | Description |
|------|------|-------------|
| `sourceDataTypeIdentifiers` | [`[DataTypeIdentifierInput!]!`](../input_object/datatypeidentifierinput.md) | The source data type identifier for the mapper |
| `target` | [`String!`](../scalar/string.md) | The target data type identifier for the mapper |
12 changes: 12 additions & 0 deletions docs/graphql/input_object/generictypeinput.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: GenericTypeInput
---

Input type for generic type operations.

## Fields

| Name | Type | Description |
|------|------|-------------|
| `dataTypeId` | [`DataTypeInput!`](../input_object/datatypeinput.md) | The data type associated with this generic type. |
| `genericMappers` | [`[GenericMapperInput!]!`](../input_object/genericmapperinput.md) | The mappers associated with this generic type. |
12 changes: 12 additions & 0 deletions docs/graphql/input_object/translationinput.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: TranslationInput
---

Represents a translation

## Fields

| Name | Type | Description |
|------|------|-------------|
| `code` | [`String!`](../scalar/string.md) | Code of the translation |
| `content` | [`String!`](../scalar/string.md) | Content of the translation |
2 changes: 1 addition & 1 deletion docs/graphql/object/datatype.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Represents a DataType
| `displayMessages` | [`[Translation!]`](../object/translation.md) | Display message of the function |
| `genericKeys` | [`[String!]`](../scalar/string.md) | Generic keys of the datatype |
| `id` | [`DataTypeID!`](../scalar/datatypeid.md) | Global ID of this DataType |
| `identifier` | [`String!`](../scalar/string.md) | The identifier scoped to the namespace |
| `identifier` | [`String!`](../scalar/string.md) | The identifier of the datatype |
| `name` | [`[Translation!]!`](../object/translation.md) | Names of the flow type setting |
| `rules` | [`DataTypeRuleConnection!`](../object/datatyperuleconnection.md) | Rules of the datatype |
| `runtime` | [`Runtime`](../object/runtime.md) | The runtime where this datatype belongs to |
Expand Down