From 135cc2472fc791fe2662bd906c54717376354647 Mon Sep 17 00:00:00 2001 From: ellisandrews-toast Date: Fri, 15 May 2026 12:45:42 -0400 Subject: [PATCH 1/6] Add references parameter to relationships --- config/schema/artifacts/data_warehouse.yaml | 4 +- config/schema/artifacts/datastore_config.yaml | 4 + config/schema/artifacts/json_schemas.yaml | 12 ++ .../artifacts/json_schemas_by_version/v1.yaml | 18 ++ config/schema/artifacts/runtime_metadata.yaml | 137 +++++++++++++++ config/schema/artifacts/schema.graphql | 163 ++++++++++++++++++ .../artifacts_with_apollo/data_warehouse.yaml | 4 +- .../datastore_config.yaml | 4 + .../artifacts_with_apollo/json_schemas.yaml | 12 ++ .../json_schemas_by_version/v1.yaml | 18 ++ .../runtime_metadata.yaml | 139 +++++++++++++++ .../artifacts_with_apollo/schema.graphql | 163 ++++++++++++++++++ config/schema/widgets.rb | 3 + .../graphql/schema/relation_join.rb | 12 +- .../spec/acceptance/hidden_types_spec.rb | 2 +- .../runtime_metadata/relation.rb | 7 +- .../runtime_metadata/relation.rbs | 3 + .../runtime_metadata/relation_spec.rb | 1 + .../runtime_metadata/schema_spec.rb | 8 +- .../schema_definition/factory.rb | 5 +- .../indexing/relationship_resolver.rb | 22 +++ .../schema_elements/relationship.rb | 4 +- .../schema_elements/type_with_subfields.rb | 68 ++++++-- .../schema_definition/factory.rbs | 3 +- .../indexing/relationship_resolver.rbs | 4 + .../schema_elements/relationship.rbs | 4 +- .../schema_elements/type_with_subfields.rbs | 5 +- .../relation_metadata_spec.rb | 35 ++++ .../update_targets_spec.rb | 62 +++++++ .../spec_support/factories/widgets.rb | 2 + .../spec_support/runtime_metadata_support.rb | 4 +- 31 files changed, 896 insertions(+), 36 deletions(-) diff --git a/config/schema/artifacts/data_warehouse.yaml b/config/schema/artifacts/data_warehouse.yaml index 6f1c02601..5e0880b4b 100644 --- a/config/schema/artifacts/data_warehouse.yaml +++ b/config/schema/artifacts/data_warehouse.yaml @@ -53,6 +53,7 @@ tables: table_schema: |- CREATE TABLE IF NOT EXISTS manufacturers ( id STRING, + guid STRING, name STRING, created_at TIMESTAMP, ceo STRUCT @@ -64,7 +65,8 @@ tables: name STRING, created_at TIMESTAMP, material STRING, - manufacturer_id STRING + manufacturer_id STRING, + manufacturer_guid STRING ) named_inventors: table_schema: |- diff --git a/config/schema/artifacts/datastore_config.yaml b/config/schema/artifacts/datastore_config.yaml index 7fd1aebc7..e094e8a06 100644 --- a/config/schema/artifacts/datastore_config.yaml +++ b/config/schema/artifacts/datastore_config.yaml @@ -1677,6 +1677,8 @@ indices: properties: id: type: keyword + guid: + type: keyword name: type: keyword created_at: @@ -1722,6 +1724,8 @@ indices: type: keyword manufacturer_id: type: keyword + manufacturer_guid: + type: keyword __sources: type: keyword __versions: diff --git a/config/schema/artifacts/json_schemas.yaml b/config/schema/artifacts/json_schemas.yaml index 64c6f7129..b06d388e3 100644 --- a/config/schema/artifacts/json_schemas.yaml +++ b/config/schema/artifacts/json_schemas.yaml @@ -400,6 +400,10 @@ json_schema_version: 1 allOf: - "$ref": "#/$defs/ID" - maxLength: 8191 + guid: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 name: anyOf: - allOf: @@ -418,6 +422,7 @@ json_schema_version: 1 default: Manufacturer required: - id + - guid - name - created_at - ceo @@ -451,6 +456,12 @@ json_schema_version: 1 - "$ref": "#/$defs/ID" - maxLength: 8191 - type: 'null' + manufacturer_guid: + anyOf: + - allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + - type: 'null' __typename: type: string const: MechanicalPart @@ -461,6 +472,7 @@ json_schema_version: 1 - created_at - material - manufacturer_id + - manufacturer_guid Money: type: object properties: diff --git a/config/schema/artifacts/json_schemas_by_version/v1.yaml b/config/schema/artifacts/json_schemas_by_version/v1.yaml index ad09ed3e1..bd11a86bd 100644 --- a/config/schema/artifacts/json_schemas_by_version/v1.yaml +++ b/config/schema/artifacts/json_schemas_by_version/v1.yaml @@ -502,6 +502,13 @@ json_schema_version: 1 ElasticGraph: type: ID! nameInIndex: id + guid: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + ElasticGraph: + type: ID! + nameInIndex: guid name: anyOf: - allOf: @@ -529,6 +536,7 @@ json_schema_version: 1 default: Manufacturer required: - id + - guid - name - created_at - ceo @@ -577,6 +585,15 @@ json_schema_version: 1 ElasticGraph: type: ID nameInIndex: manufacturer_id + manufacturer_guid: + anyOf: + - allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + - type: 'null' + ElasticGraph: + type: ID + nameInIndex: manufacturer_guid __typename: type: string const: MechanicalPart @@ -587,6 +604,7 @@ json_schema_version: 1 - created_at - material - manufacturer_id + - manufacturer_guid Money: type: object properties: diff --git a/config/schema/artifacts/runtime_metadata.yaml b/config/schema/artifacts/runtime_metadata.yaml index af13b9a27..6b6c84014 100644 --- a/config/schema/artifacts/runtime_metadata.yaml +++ b/config/schema/artifacts/runtime_metadata.yaml @@ -325,6 +325,14 @@ enum_types_by_name: sort_field: direction: desc field_path: created_at + guid_ASC: + sort_field: + direction: asc + field_path: guid + guid_DESC: + sort_field: + direction: desc + field_path: guid id_ASC: sort_field: direction: asc @@ -515,6 +523,14 @@ enum_types_by_name: sort_field: direction: desc field_path: created_on + guid_ASC: + sort_field: + direction: asc + field_path: guid + guid_DESC: + sort_field: + direction: desc + field_path: guid id_ASC: sort_field: direction: asc @@ -1922,6 +1938,8 @@ index_definitions_by_name: source: __self created_at: source: __self + guid: + source: __self id: source: __self name: @@ -1938,6 +1956,8 @@ index_definitions_by_name: source: __self id: source: __self + manufacturer_guid: + source: __self manufacturer_id: source: __self material: @@ -3055,6 +3075,7 @@ object_types_by_name: relation: direction: out foreign_key: manufacturer_id + references: id resolver: name: nested_relationships shapes: @@ -3332,6 +3353,7 @@ object_types_by_name: - 100 direction: in foreign_key: component_ids + references: id resolver: name: nested_relationships id: @@ -3344,12 +3366,14 @@ object_types_by_name: relation: direction: out foreign_key: part_ids + references: id resolver: name: nested_relationships parts: relation: direction: out foreign_key: part_ids + references: id resolver: name: nested_relationships position: @@ -3362,12 +3386,14 @@ object_types_by_name: relation: direction: in foreign_key: component_ids + references: id resolver: name: nested_relationships widget_aggregations: relation: direction: in foreign_key: component_ids + references: id resolver: name: nested_relationships widget_cost: @@ -3390,6 +3416,7 @@ object_types_by_name: relation: direction: in foreign_key: component_ids + references: id resolver: name: nested_relationships index_definition_names: @@ -3849,12 +3876,14 @@ object_types_by_name: relation: direction: in foreign_key: part_ids + references: id resolver: name: nested_relationships components: relation: direction: in foreign_key: part_ids + references: id resolver: name: nested_relationships created_at: @@ -3867,6 +3896,7 @@ object_types_by_name: relation: direction: out foreign_key: manufacturer_id + references: id resolver: name: nested_relationships name: @@ -4334,6 +4364,7 @@ object_types_by_name: relation: direction: in foreign_key: manufacturer_id + references: id resolver: name: nested_relationships ceo: @@ -4342,6 +4373,9 @@ object_types_by_name: created_at: resolver: name: get_record_field_value + guid: + resolver: + name: get_record_field_value id: resolver: name: get_record_field_value @@ -4349,12 +4383,28 @@ object_types_by_name: relation: direction: in foreign_key: manufacturer_id + references: id resolver: name: nested_relationships manufactured_parts: relation: direction: in foreign_key: manufacturer_id + references: id + resolver: + name: nested_relationships + mechanical_part_aggregations: + relation: + direction: in + foreign_key: manufacturer_guid + references: guid + resolver: + name: nested_relationships + mechanical_parts: + relation: + direction: in + foreign_key: manufacturer_guid + references: guid resolver: name: nested_relationships name: @@ -4368,6 +4418,8 @@ object_types_by_name: cardinality: one created_at: cardinality: one + guid: + cardinality: one name: cardinality: one id_source: id @@ -4394,6 +4446,9 @@ object_types_by_name: created_at: resolver: name: object_with_lookahead + guid: + resolver: + name: object_with_lookahead id: resolver: name: object_with_lookahead @@ -4472,6 +4527,9 @@ object_types_by_name: created_at: resolver: name: object_with_lookahead + guid: + resolver: + name: object_with_lookahead name: resolver: name: object_with_lookahead @@ -4480,6 +4538,9 @@ object_types_by_name: ceo: resolver: name: get_record_field_value + guid: + resolver: + name: get_record_field_value id: resolver: name: get_record_field_value @@ -4492,12 +4553,14 @@ object_types_by_name: relation: direction: in foreign_key: part_ids + references: id resolver: name: nested_relationships components: relation: direction: in foreign_key: part_ids + references: id resolver: name: nested_relationships created_at: @@ -4510,6 +4573,14 @@ object_types_by_name: relation: direction: out foreign_key: manufacturer_id + references: id + resolver: + name: nested_relationships + manufacturer_by_guid: + relation: + direction: out + foreign_key: manufacturer_guid + references: guid resolver: name: nested_relationships material: @@ -4524,6 +4595,8 @@ object_types_by_name: - data_params: created_at: cardinality: one + manufacturer_guid: + cardinality: one manufacturer_id: cardinality: one material: @@ -4689,6 +4762,7 @@ object_types_by_name: relation: direction: in foreign_key: manufacturer_id + references: id resolver: name: nested_relationships amount_cents: @@ -4708,12 +4782,14 @@ object_types_by_name: relation: direction: out foreign_key: component_ids + references: id resolver: name: nested_relationships components: relation: direction: out foreign_key: component_ids + references: id resolver: name: nested_relationships cost: @@ -4759,11 +4835,15 @@ object_types_by_name: - 100 direction: in foreign_key: component_ids + references: id resolver: name: nested_relationships fees: resolver: name: get_record_field_value + guid: + resolver: + name: get_record_field_value id: resolver: name: get_record_field_value @@ -4786,23 +4866,47 @@ object_types_by_name: relation: direction: in foreign_key: manufacturer_id + references: id resolver: name: nested_relationships manufactured_parts: relation: direction: in foreign_key: manufacturer_id + references: id resolver: name: nested_relationships manufacturer: relation: direction: out foreign_key: manufacturer_id + references: id + resolver: + name: nested_relationships + manufacturer_by_guid: + relation: + direction: out + foreign_key: manufacturer_guid + references: guid resolver: name: nested_relationships material: resolver: name: get_record_field_value + mechanical_part_aggregations: + relation: + direction: in + foreign_key: manufacturer_guid + references: guid + resolver: + name: nested_relationships + mechanical_parts: + relation: + direction: in + foreign_key: manufacturer_guid + references: guid + resolver: + name: nested_relationships metadata: resolver: name: get_record_field_value @@ -4822,12 +4926,14 @@ object_types_by_name: relation: direction: out foreign_key: part_ids + references: id resolver: name: nested_relationships parts: relation: direction: out foreign_key: part_ids + references: id resolver: name: nested_relationships position: @@ -4863,12 +4969,14 @@ object_types_by_name: relation: direction: in foreign_key: component_ids + references: id resolver: name: nested_relationships widget_aggregations: relation: direction: in foreign_key: component_ids + references: id resolver: name: nested_relationships widget_cost: @@ -4891,6 +4999,7 @@ object_types_by_name: relation: direction: in foreign_key: component_ids + references: id resolver: name: nested_relationships workspace_id: @@ -4949,6 +5058,9 @@ object_types_by_name: fees: resolver: name: object_with_lookahead + guid: + resolver: + name: object_with_lookahead id: resolver: name: object_with_lookahead @@ -5160,6 +5272,9 @@ object_types_by_name: fees: resolver: name: object_with_lookahead + guid: + resolver: + name: object_with_lookahead internal_details: resolver: name: object_with_lookahead @@ -5268,6 +5383,9 @@ object_types_by_name: fees: resolver: name: get_record_field_value + guid: + resolver: + name: get_record_field_value id: resolver: name: get_record_field_value @@ -5528,12 +5646,14 @@ object_types_by_name: relation: direction: in foreign_key: part_ids + references: id resolver: name: nested_relationships components: relation: direction: in foreign_key: part_ids + references: id resolver: name: nested_relationships created_at: @@ -5546,6 +5666,14 @@ object_types_by_name: relation: direction: out foreign_key: manufacturer_id + references: id + resolver: + name: nested_relationships + manufacturer_by_guid: + relation: + direction: out + foreign_key: manufacturer_guid + references: guid resolver: name: nested_relationships material: @@ -6252,12 +6380,14 @@ object_types_by_name: foreign_key_nested_paths: - current_players_nested - current_players_nested.affiliations.sponsorships_nested + references: id resolver: name: nested_relationships affiliated_team_from_object_aggregations: relation: direction: in foreign_key: current_players_object.affiliations.sponsorships_object.sponsor_id + references: id resolver: name: nested_relationships affiliated_teams_from_nested: @@ -6267,12 +6397,14 @@ object_types_by_name: foreign_key_nested_paths: - current_players_nested - current_players_nested.affiliations.sponsorships_nested + references: id resolver: name: nested_relationships affiliated_teams_from_object: relation: direction: in foreign_key: current_players_object.affiliations.sponsorships_object.sponsor_id + references: id resolver: name: nested_relationships id: @@ -7590,12 +7722,14 @@ object_types_by_name: relation: direction: out foreign_key: component_ids + references: id resolver: name: nested_relationships components: relation: direction: out foreign_key: component_ids + references: id resolver: name: nested_relationships cost: @@ -8571,12 +8705,14 @@ object_types_by_name: relation: direction: out foreign_key: component_ids + references: id resolver: name: nested_relationships components: relation: direction: out foreign_key: component_ids + references: id resolver: name: nested_relationships cost: @@ -8644,6 +8780,7 @@ object_types_by_name: relation: direction: out foreign_key: manufacturer_id + references: id resolver: name: nested_relationships metadata: diff --git a/config/schema/artifacts/schema.graphql b/config/schema/artifacts/schema.graphql index 3c6220fba..d0c2e7b0f 100644 --- a/config/schema/artifacts/schema.graphql +++ b/config/schema/artifacts/schema.graphql @@ -4764,6 +4764,7 @@ type Manufacturer implements NamedEntity { address: Address ceo: Person created_at: DateTime! + guid: ID! id: ID! """ @@ -4862,6 +4863,103 @@ type Manufacturer implements NamedEntity { """ order_by: [PartSortOrderInput!] ): PartConnection + + """ + Aggregations over the `mechanical_parts` data. + """ + mechanical_part_aggregations( + """ + Used to forward-paginate through the `mechanical_part_aggregations`. When provided, the next page after the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + after: Cursor + + """ + Used to backward-paginate through the `mechanical_part_aggregations`. When provided, the previous page before the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + before: Cursor + + """ + Used to filter the `MechanicalPart` documents that get aggregated over based on the provided criteria. + """ + filter: MechanicalPartFilterInput + + """ + Used in conjunction with the `after` argument to forward-paginate through the `mechanical_part_aggregations`. + When provided, limits the number of returned results to the first `n` after the provided + `after` cursor (or from the start of the `mechanical_part_aggregations`, if no `after` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + first: Int + + """ + Used in conjunction with the `before` argument to backward-paginate through the `mechanical_part_aggregations`. + When provided, limits the number of returned results to the last `n` before the provided + `before` cursor (or from the end of the `mechanical_part_aggregations`, if no `before` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + last: Int + ): MechanicalPartAggregationConnection + mechanical_parts( + """ + Used to forward-paginate through the `mechanical_parts`. When provided, the next page after the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + after: Cursor + + """ + Used to backward-paginate through the `mechanical_parts`. When provided, the previous page before the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + before: Cursor + + """ + Used to filter the returned `mechanical_parts` based on the provided criteria. + """ + filter: MechanicalPartFilterInput + + """ + Used in conjunction with the `after` argument to forward-paginate through the `mechanical_parts`. + When provided, limits the number of returned results to the first `n` after the provided + `after` cursor (or from the start of the `mechanical_parts`, if no `after` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + first: Int + + """ + Used in conjunction with the `before` argument to backward-paginate through the `mechanical_parts`. + When provided, limits the number of returned results to the last `n` before the provided + `before` cursor (or from the end of the `mechanical_parts`, if no `before` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + last: Int + + """ + Used to specify how the returned `mechanical_parts` should be sorted. + """ + order_by: [MechanicalPartSortOrderInput!] + ): MechanicalPartConnection name: String } @@ -4879,6 +4977,11 @@ type ManufacturerAggregatedValues { """ created_at: DateTimeAggregatedValues + """ + Computed aggregate values for the `guid` field. + """ + guid: NonNumericAggregatedValues + """ Computed aggregate values for the `id` field. """ @@ -5052,6 +5155,13 @@ input ManufacturerFilterInput { """ created_at: DateTimeFilterInput + """ + Used to filter on the `guid` field. + + When `null` or an empty object is passed, matches all documents. + """ + guid: IDFilterInput + """ Used to filter on the `id` field. @@ -5089,6 +5199,11 @@ type ManufacturerGroupedBy { """ created_at: DateTimeGroupedBy + """ + The `guid` field value for this group. + """ + guid: ID + """ The `name` field value for this group. """ @@ -5104,6 +5219,11 @@ type ManufacturerHighlights { """ ceo: PersonHighlights + """ + Search highlights for the `guid`, providing snippets of the matching text. + """ + guid: [String!]! + """ Search highlights for the `id`, providing snippets of the matching text. """ @@ -5159,6 +5279,16 @@ enum ManufacturerSortOrderInput { """ created_at_DESC + """ + Sorts ascending by the `guid` field. + """ + guid_ASC + + """ + Sorts descending by the `guid` field. + """ + guid_DESC + """ Sorts ascending by the `id` field. """ @@ -5421,6 +5551,7 @@ type MechanicalPart implements NamedEntity { created_at: DateTime! id: ID! manufacturer: Manufacturer + manufacturer_by_guid: Manufacturer material: Material name: String } @@ -6008,6 +6139,11 @@ type NamedEntityAggregatedValues { """ fees: MoneyAggregatedValues + """ + Computed aggregate values for the `guid` field. + """ + guid: NonNumericAggregatedValues + """ Computed aggregate values for the `id` field. """ @@ -6412,6 +6548,13 @@ input NamedEntityFilterInput { """ fees: MoneyFieldsListFilterInput + """ + Used to filter on the `guid` field. + + When `null` or an empty object is passed, matches all documents. + """ + guid: IDFilterInput + """ Used to filter on the `id` field. @@ -6698,6 +6841,11 @@ type NamedEntityGroupedBy { """ fees: MoneyGroupedBy + """ + The `guid` field value for this group. + """ + guid: ID + """ The `internal_details` field value for this group. """ @@ -6887,6 +7035,11 @@ type NamedEntityHighlights { """ fees: MoneyHighlights + """ + Search highlights for the `guid`, providing snippets of the matching text. + """ + guid: [String!]! + """ Search highlights for the `id`, providing snippets of the matching text. """ @@ -7152,6 +7305,16 @@ enum NamedEntitySortOrderInput { """ created_on_DESC + """ + Sorts ascending by the `guid` field. + """ + guid_ASC + + """ + Sorts descending by the `guid` field. + """ + guid_DESC + """ Sorts ascending by the `id` field. """ diff --git a/config/schema/artifacts_with_apollo/data_warehouse.yaml b/config/schema/artifacts_with_apollo/data_warehouse.yaml index 6f1c02601..5e0880b4b 100644 --- a/config/schema/artifacts_with_apollo/data_warehouse.yaml +++ b/config/schema/artifacts_with_apollo/data_warehouse.yaml @@ -53,6 +53,7 @@ tables: table_schema: |- CREATE TABLE IF NOT EXISTS manufacturers ( id STRING, + guid STRING, name STRING, created_at TIMESTAMP, ceo STRUCT @@ -64,7 +65,8 @@ tables: name STRING, created_at TIMESTAMP, material STRING, - manufacturer_id STRING + manufacturer_id STRING, + manufacturer_guid STRING ) named_inventors: table_schema: |- diff --git a/config/schema/artifacts_with_apollo/datastore_config.yaml b/config/schema/artifacts_with_apollo/datastore_config.yaml index 7fd1aebc7..e094e8a06 100644 --- a/config/schema/artifacts_with_apollo/datastore_config.yaml +++ b/config/schema/artifacts_with_apollo/datastore_config.yaml @@ -1677,6 +1677,8 @@ indices: properties: id: type: keyword + guid: + type: keyword name: type: keyword created_at: @@ -1722,6 +1724,8 @@ indices: type: keyword manufacturer_id: type: keyword + manufacturer_guid: + type: keyword __sources: type: keyword __versions: diff --git a/config/schema/artifacts_with_apollo/json_schemas.yaml b/config/schema/artifacts_with_apollo/json_schemas.yaml index 64c6f7129..b06d388e3 100644 --- a/config/schema/artifacts_with_apollo/json_schemas.yaml +++ b/config/schema/artifacts_with_apollo/json_schemas.yaml @@ -400,6 +400,10 @@ json_schema_version: 1 allOf: - "$ref": "#/$defs/ID" - maxLength: 8191 + guid: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 name: anyOf: - allOf: @@ -418,6 +422,7 @@ json_schema_version: 1 default: Manufacturer required: - id + - guid - name - created_at - ceo @@ -451,6 +456,12 @@ json_schema_version: 1 - "$ref": "#/$defs/ID" - maxLength: 8191 - type: 'null' + manufacturer_guid: + anyOf: + - allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + - type: 'null' __typename: type: string const: MechanicalPart @@ -461,6 +472,7 @@ json_schema_version: 1 - created_at - material - manufacturer_id + - manufacturer_guid Money: type: object properties: diff --git a/config/schema/artifacts_with_apollo/json_schemas_by_version/v1.yaml b/config/schema/artifacts_with_apollo/json_schemas_by_version/v1.yaml index ad09ed3e1..bd11a86bd 100644 --- a/config/schema/artifacts_with_apollo/json_schemas_by_version/v1.yaml +++ b/config/schema/artifacts_with_apollo/json_schemas_by_version/v1.yaml @@ -502,6 +502,13 @@ json_schema_version: 1 ElasticGraph: type: ID! nameInIndex: id + guid: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + ElasticGraph: + type: ID! + nameInIndex: guid name: anyOf: - allOf: @@ -529,6 +536,7 @@ json_schema_version: 1 default: Manufacturer required: - id + - guid - name - created_at - ceo @@ -577,6 +585,15 @@ json_schema_version: 1 ElasticGraph: type: ID nameInIndex: manufacturer_id + manufacturer_guid: + anyOf: + - allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + - type: 'null' + ElasticGraph: + type: ID + nameInIndex: manufacturer_guid __typename: type: string const: MechanicalPart @@ -587,6 +604,7 @@ json_schema_version: 1 - created_at - material - manufacturer_id + - manufacturer_guid Money: type: object properties: diff --git a/config/schema/artifacts_with_apollo/runtime_metadata.yaml b/config/schema/artifacts_with_apollo/runtime_metadata.yaml index 4769e19ad..e2372579f 100644 --- a/config/schema/artifacts_with_apollo/runtime_metadata.yaml +++ b/config/schema/artifacts_with_apollo/runtime_metadata.yaml @@ -325,6 +325,14 @@ enum_types_by_name: sort_field: direction: desc field_path: created_at + guid_ASC: + sort_field: + direction: asc + field_path: guid + guid_DESC: + sort_field: + direction: desc + field_path: guid id_ASC: sort_field: direction: asc @@ -515,6 +523,14 @@ enum_types_by_name: sort_field: direction: desc field_path: created_on + guid_ASC: + sort_field: + direction: asc + field_path: guid + guid_DESC: + sort_field: + direction: desc + field_path: guid id_ASC: sort_field: direction: asc @@ -1951,6 +1967,8 @@ index_definitions_by_name: source: __self created_at: source: __self + guid: + source: __self id: source: __self name: @@ -1967,6 +1985,8 @@ index_definitions_by_name: source: __self id: source: __self + manufacturer_guid: + source: __self manufacturer_id: source: __self material: @@ -3084,6 +3104,7 @@ object_types_by_name: relation: direction: out foreign_key: manufacturer_id + references: id resolver: name: nested_relationships shapes: @@ -3361,6 +3382,7 @@ object_types_by_name: - 100 direction: in foreign_key: component_ids + references: id resolver: name: nested_relationships id: @@ -3394,12 +3416,14 @@ object_types_by_name: relation: direction: out foreign_key: part_ids + references: id resolver: name: nested_relationships parts: relation: direction: out foreign_key: part_ids + references: id resolver: name: nested_relationships position: @@ -3412,12 +3436,14 @@ object_types_by_name: relation: direction: in foreign_key: component_ids + references: id resolver: name: nested_relationships widget_aggregations: relation: direction: in foreign_key: component_ids + references: id resolver: name: nested_relationships widget_cost: @@ -3440,6 +3466,7 @@ object_types_by_name: relation: direction: in foreign_key: component_ids + references: id resolver: name: nested_relationships index_definition_names: @@ -3672,12 +3699,14 @@ object_types_by_name: relation: direction: in foreign_key: country_code + references: id resolver: name: nested_relationships teams: relation: direction: in foreign_key: country_code + references: id resolver: name: nested_relationships CurrencyDetails: @@ -3951,12 +3980,14 @@ object_types_by_name: relation: direction: in foreign_key: part_ids + references: id resolver: name: nested_relationships components: relation: direction: in foreign_key: part_ids + references: id resolver: name: nested_relationships created_at: @@ -3969,6 +4000,7 @@ object_types_by_name: relation: direction: out foreign_key: manufacturer_id + references: id resolver: name: nested_relationships name: @@ -4436,6 +4468,7 @@ object_types_by_name: relation: direction: in foreign_key: manufacturer_id + references: id resolver: name: nested_relationships ceo: @@ -4444,6 +4477,9 @@ object_types_by_name: created_at: resolver: name: get_record_field_value + guid: + resolver: + name: get_record_field_value id: resolver: name: get_record_field_value @@ -4451,12 +4487,28 @@ object_types_by_name: relation: direction: in foreign_key: manufacturer_id + references: id resolver: name: nested_relationships manufactured_parts: relation: direction: in foreign_key: manufacturer_id + references: id + resolver: + name: nested_relationships + mechanical_part_aggregations: + relation: + direction: in + foreign_key: manufacturer_guid + references: guid + resolver: + name: nested_relationships + mechanical_parts: + relation: + direction: in + foreign_key: manufacturer_guid + references: guid resolver: name: nested_relationships name: @@ -4470,6 +4522,8 @@ object_types_by_name: cardinality: one created_at: cardinality: one + guid: + cardinality: one name: cardinality: one id_source: id @@ -4496,6 +4550,9 @@ object_types_by_name: created_at: resolver: name: object_with_lookahead + guid: + resolver: + name: object_with_lookahead id: resolver: name: object_with_lookahead @@ -4574,6 +4631,9 @@ object_types_by_name: created_at: resolver: name: object_with_lookahead + guid: + resolver: + name: object_with_lookahead name: resolver: name: object_with_lookahead @@ -4582,6 +4642,9 @@ object_types_by_name: ceo: resolver: name: get_record_field_value + guid: + resolver: + name: get_record_field_value id: resolver: name: get_record_field_value @@ -4594,12 +4657,14 @@ object_types_by_name: relation: direction: in foreign_key: part_ids + references: id resolver: name: nested_relationships components: relation: direction: in foreign_key: part_ids + references: id resolver: name: nested_relationships created_at: @@ -4612,6 +4677,14 @@ object_types_by_name: relation: direction: out foreign_key: manufacturer_id + references: id + resolver: + name: nested_relationships + manufacturer_by_guid: + relation: + direction: out + foreign_key: manufacturer_guid + references: guid resolver: name: nested_relationships material: @@ -4626,6 +4699,8 @@ object_types_by_name: - data_params: created_at: cardinality: one + manufacturer_guid: + cardinality: one manufacturer_id: cardinality: one material: @@ -4791,6 +4866,7 @@ object_types_by_name: relation: direction: in foreign_key: manufacturer_id + references: id resolver: name: nested_relationships amount_cents: @@ -4810,12 +4886,14 @@ object_types_by_name: relation: direction: out foreign_key: component_ids + references: id resolver: name: nested_relationships components: relation: direction: out foreign_key: component_ids + references: id resolver: name: nested_relationships cost: @@ -4861,11 +4939,15 @@ object_types_by_name: - 100 direction: in foreign_key: component_ids + references: id resolver: name: nested_relationships fees: resolver: name: get_record_field_value + guid: + resolver: + name: get_record_field_value id: resolver: name: get_record_field_value @@ -4888,23 +4970,47 @@ object_types_by_name: relation: direction: in foreign_key: manufacturer_id + references: id resolver: name: nested_relationships manufactured_parts: relation: direction: in foreign_key: manufacturer_id + references: id resolver: name: nested_relationships manufacturer: relation: direction: out foreign_key: manufacturer_id + references: id + resolver: + name: nested_relationships + manufacturer_by_guid: + relation: + direction: out + foreign_key: manufacturer_guid + references: guid resolver: name: nested_relationships material: resolver: name: get_record_field_value + mechanical_part_aggregations: + relation: + direction: in + foreign_key: manufacturer_guid + references: guid + resolver: + name: nested_relationships + mechanical_parts: + relation: + direction: in + foreign_key: manufacturer_guid + references: guid + resolver: + name: nested_relationships metadata: resolver: name: get_record_field_value @@ -4945,12 +5051,14 @@ object_types_by_name: relation: direction: out foreign_key: part_ids + references: id resolver: name: nested_relationships parts: relation: direction: out foreign_key: part_ids + references: id resolver: name: nested_relationships position: @@ -4986,12 +5094,14 @@ object_types_by_name: relation: direction: in foreign_key: component_ids + references: id resolver: name: nested_relationships widget_aggregations: relation: direction: in foreign_key: component_ids + references: id resolver: name: nested_relationships widget_cost: @@ -5014,6 +5124,7 @@ object_types_by_name: relation: direction: in foreign_key: component_ids + references: id resolver: name: nested_relationships workspace_id: @@ -5072,6 +5183,9 @@ object_types_by_name: fees: resolver: name: object_with_lookahead + guid: + resolver: + name: object_with_lookahead id: resolver: name: object_with_lookahead @@ -5283,6 +5397,9 @@ object_types_by_name: fees: resolver: name: object_with_lookahead + guid: + resolver: + name: object_with_lookahead internal_details: resolver: name: object_with_lookahead @@ -5391,6 +5508,9 @@ object_types_by_name: fees: resolver: name: get_record_field_value + guid: + resolver: + name: get_record_field_value id: resolver: name: get_record_field_value @@ -5651,12 +5771,14 @@ object_types_by_name: relation: direction: in foreign_key: part_ids + references: id resolver: name: nested_relationships components: relation: direction: in foreign_key: part_ids + references: id resolver: name: nested_relationships created_at: @@ -5669,6 +5791,14 @@ object_types_by_name: relation: direction: out foreign_key: manufacturer_id + references: id + resolver: + name: nested_relationships + manufacturer_by_guid: + relation: + direction: out + foreign_key: manufacturer_guid + references: guid resolver: name: nested_relationships material: @@ -6381,12 +6511,14 @@ object_types_by_name: foreign_key_nested_paths: - current_players_nested - current_players_nested.affiliations.sponsorships_nested + references: id resolver: name: nested_relationships affiliated_team_from_object_aggregations: relation: direction: in foreign_key: current_players_object.affiliations.sponsorships_object.sponsor_id + references: id resolver: name: nested_relationships affiliated_teams_from_nested: @@ -6396,12 +6528,14 @@ object_types_by_name: foreign_key_nested_paths: - current_players_nested - current_players_nested.affiliations.sponsorships_nested + references: id resolver: name: nested_relationships affiliated_teams_from_object: relation: direction: in foreign_key: current_players_object.affiliations.sponsorships_object.sponsor_id + references: id resolver: name: nested_relationships id: @@ -7719,12 +7853,14 @@ object_types_by_name: relation: direction: out foreign_key: component_ids + references: id resolver: name: nested_relationships components: relation: direction: out foreign_key: component_ids + references: id resolver: name: nested_relationships cost: @@ -8700,12 +8836,14 @@ object_types_by_name: relation: direction: out foreign_key: component_ids + references: id resolver: name: nested_relationships components: relation: direction: out foreign_key: component_ids + references: id resolver: name: nested_relationships cost: @@ -8773,6 +8911,7 @@ object_types_by_name: relation: direction: out foreign_key: manufacturer_id + references: id resolver: name: nested_relationships metadata: diff --git a/config/schema/artifacts_with_apollo/schema.graphql b/config/schema/artifacts_with_apollo/schema.graphql index 7f97bcee0..674a170f9 100644 --- a/config/schema/artifacts_with_apollo/schema.graphql +++ b/config/schema/artifacts_with_apollo/schema.graphql @@ -5046,6 +5046,7 @@ type Manufacturer implements NamedEntity @key(fields: "id") { address: Address ceo: Person created_at: DateTime! + guid: ID! id: ID! """ @@ -5144,6 +5145,103 @@ type Manufacturer implements NamedEntity @key(fields: "id") { """ order_by: [PartSortOrderInput!] ): PartConnection + + """ + Aggregations over the `mechanical_parts` data. + """ + mechanical_part_aggregations( + """ + Used to forward-paginate through the `mechanical_part_aggregations`. When provided, the next page after the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + after: Cursor + + """ + Used to backward-paginate through the `mechanical_part_aggregations`. When provided, the previous page before the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + before: Cursor + + """ + Used to filter the `MechanicalPart` documents that get aggregated over based on the provided criteria. + """ + filter: MechanicalPartFilterInput + + """ + Used in conjunction with the `after` argument to forward-paginate through the `mechanical_part_aggregations`. + When provided, limits the number of returned results to the first `n` after the provided + `after` cursor (or from the start of the `mechanical_part_aggregations`, if no `after` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + first: Int + + """ + Used in conjunction with the `before` argument to backward-paginate through the `mechanical_part_aggregations`. + When provided, limits the number of returned results to the last `n` before the provided + `before` cursor (or from the end of the `mechanical_part_aggregations`, if no `before` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + last: Int + ): MechanicalPartAggregationConnection + mechanical_parts( + """ + Used to forward-paginate through the `mechanical_parts`. When provided, the next page after the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + after: Cursor + + """ + Used to backward-paginate through the `mechanical_parts`. When provided, the previous page before the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + before: Cursor + + """ + Used to filter the returned `mechanical_parts` based on the provided criteria. + """ + filter: MechanicalPartFilterInput + + """ + Used in conjunction with the `after` argument to forward-paginate through the `mechanical_parts`. + When provided, limits the number of returned results to the first `n` after the provided + `after` cursor (or from the start of the `mechanical_parts`, if no `after` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + first: Int + + """ + Used in conjunction with the `before` argument to backward-paginate through the `mechanical_parts`. + When provided, limits the number of returned results to the last `n` before the provided + `before` cursor (or from the end of the `mechanical_parts`, if no `before` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + last: Int + + """ + Used to specify how the returned `mechanical_parts` should be sorted. + """ + order_by: [MechanicalPartSortOrderInput!] + ): MechanicalPartConnection name: String } @@ -5161,6 +5259,11 @@ type ManufacturerAggregatedValues { """ created_at: DateTimeAggregatedValues + """ + Computed aggregate values for the `guid` field. + """ + guid: NonNumericAggregatedValues + """ Computed aggregate values for the `id` field. """ @@ -5334,6 +5437,13 @@ input ManufacturerFilterInput { """ created_at: DateTimeFilterInput + """ + Used to filter on the `guid` field. + + When `null` or an empty object is passed, matches all documents. + """ + guid: IDFilterInput + """ Used to filter on the `id` field. @@ -5371,6 +5481,11 @@ type ManufacturerGroupedBy { """ created_at: DateTimeGroupedBy + """ + The `guid` field value for this group. + """ + guid: ID + """ The `name` field value for this group. """ @@ -5386,6 +5501,11 @@ type ManufacturerHighlights { """ ceo: PersonHighlights + """ + Search highlights for the `guid`, providing snippets of the matching text. + """ + guid: [String!]! + """ Search highlights for the `id`, providing snippets of the matching text. """ @@ -5441,6 +5561,16 @@ enum ManufacturerSortOrderInput { """ created_at_DESC + """ + Sorts ascending by the `guid` field. + """ + guid_ASC + + """ + Sorts descending by the `guid` field. + """ + guid_DESC + """ Sorts ascending by the `id` field. """ @@ -5703,6 +5833,7 @@ type MechanicalPart implements NamedEntity @key(fields: "id") { created_at: DateTime! id: ID! manufacturer: Manufacturer + manufacturer_by_guid: Manufacturer material: Material name: String } @@ -6290,6 +6421,11 @@ type NamedEntityAggregatedValues { """ fees: MoneyAggregatedValues + """ + Computed aggregate values for the `guid` field. + """ + guid: NonNumericAggregatedValues + """ Computed aggregate values for the `id` field. """ @@ -6694,6 +6830,13 @@ input NamedEntityFilterInput { """ fees: MoneyFieldsListFilterInput + """ + Used to filter on the `guid` field. + + When `null` or an empty object is passed, matches all documents. + """ + guid: IDFilterInput + """ Used to filter on the `id` field. @@ -6980,6 +7123,11 @@ type NamedEntityGroupedBy { """ fees: MoneyGroupedBy + """ + The `guid` field value for this group. + """ + guid: ID + """ The `internal_details` field value for this group. """ @@ -7169,6 +7317,11 @@ type NamedEntityHighlights { """ fees: MoneyHighlights + """ + Search highlights for the `guid`, providing snippets of the matching text. + """ + guid: [String!]! + """ Search highlights for the `id`, providing snippets of the matching text. """ @@ -7434,6 +7587,16 @@ enum NamedEntitySortOrderInput { """ created_on_DESC + """ + Sorts ascending by the `guid` field. + """ + guid_ASC + + """ + Sorts descending by the `guid` field. + """ + guid_DESC + """ Sorts ascending by the `id` field. """ diff --git a/config/schema/widgets.rb b/config/schema/widgets.rb index 490f85408..41289d028 100644 --- a/config/schema/widgets.rb +++ b/config/schema/widgets.rb @@ -320,6 +320,7 @@ t.field "material", "Material" t.relates_to_many "components", "Component", via: "part_ids", dir: :in, singular: "component" t.relates_to_one "manufacturer", "Manufacturer", via: "manufacturer_id", dir: :out + t.relates_to_one "manufacturer_by_guid", "Manufacturer", via: "manufacturer_guid", references: "guid", dir: :out t.index "mechanical_parts" do |i| i.default_sort "created_at", :desc @@ -414,10 +415,12 @@ t.root_query_fields plural: "manufacturers" t.implements "NamedEntity" t.field "id", "ID!" + t.field "guid", "ID!" t.field "name", "String" t.field "created_at", "DateTime!" t.field "ceo", "Person" t.relates_to_many "manufactured_parts", "Part", via: "manufacturer_id", dir: :in, singular: "manufactured_part" + t.relates_to_many "mechanical_parts", "MechanicalPart", via: "manufacturer_guid", references: "guid", dir: :in, singular: "mechanical_part" t.relates_to_one "address", "Address", via: "manufacturer_id", dir: :in t.index "manufacturers" do |i| diff --git a/elasticgraph-graphql/lib/elastic_graph/graphql/schema/relation_join.rb b/elasticgraph-graphql/lib/elastic_graph/graphql/schema/relation_join.rb index 320dbec53..485a2f081 100644 --- a/elasticgraph-graphql/lib/elastic_graph/graphql/schema/relation_join.rb +++ b/elasticgraph-graphql/lib/elastic_graph/graphql/schema/relation_join.rb @@ -33,15 +33,15 @@ def self.from(field) if relation.direction == :in # An inbound foreign key has some field (such as `foo_id`) on another document that points - # back to the `id` field on the document with the relation. + # back to the `references` field on the document with the relation. # - # The cardinality of the document id field on an inbound relation is always 1 since - # it is always the primary key `id` field. - new(field, "id", relation.foreign_key, Cardinality::One, doc_cardinality, relation.additional_filter, relation.foreign_key_nested_paths) + # The cardinality of the referenced field on an inbound relation is always 1 since + # it is expected to be a unique identifier field. + new(field, relation.references, relation.foreign_key, Cardinality::One, doc_cardinality, relation.additional_filter, relation.foreign_key_nested_paths) else # An outbound foreign key has some field (such as `foo_id`) on the document with the relation - # that point out to the `id` field of another document. - new(field, relation.foreign_key, "id", doc_cardinality, doc_cardinality, relation.additional_filter, relation.foreign_key_nested_paths) + # that points out to the `references` field of another document. + new(field, relation.foreign_key, relation.references, doc_cardinality, doc_cardinality, relation.additional_filter, relation.foreign_key_nested_paths) end end diff --git a/elasticgraph-graphql/spec/acceptance/hidden_types_spec.rb b/elasticgraph-graphql/spec/acceptance/hidden_types_spec.rb index e25c611df..f7d165f3b 100644 --- a/elasticgraph-graphql/spec/acceptance/hidden_types_spec.rb +++ b/elasticgraph-graphql/spec/acceptance/hidden_types_spec.rb @@ -53,7 +53,7 @@ module ElasticGraph expect(hidden_fields).to eq( "Query" => [case_correctly("address_aggregations"), "addresses", case_correctly("mechanical_part_aggregations"), case_correctly("mechanical_parts")], - "Manufacturer" => ["address"] + "Manufacturer" => ["address", case_correctly("mechanical_part_aggregations"), case_correctly("mechanical_parts")] ) # Our mechanism for determining which types to hide on the basis of inaccessible indexes uses the type name. diff --git a/elasticgraph-schema_artifacts/lib/elastic_graph/schema_artifacts/runtime_metadata/relation.rb b/elasticgraph-schema_artifacts/lib/elastic_graph/schema_artifacts/runtime_metadata/relation.rb index 035c06edc..3a246b015 100644 --- a/elasticgraph-schema_artifacts/lib/elastic_graph/schema_artifacts/runtime_metadata/relation.rb +++ b/elasticgraph-schema_artifacts/lib/elastic_graph/schema_artifacts/runtime_metadata/relation.rb @@ -10,9 +10,10 @@ module ElasticGraph module SchemaArtifacts module RuntimeMetadata # @private - class Relation < ::Data.define(:foreign_key, :direction, :additional_filter, :foreign_key_nested_paths) + class Relation < ::Data.define(:foreign_key, :direction, :references, :additional_filter, :foreign_key_nested_paths) FOREIGN_KEY = "foreign_key" DIRECTION = "direction" + REFERENCES = "references" ADDITIONAL_FILTER = "additional_filter" FOREIGN_KEY_NESTED_PATHS = "foreign_key_nested_paths" @@ -20,6 +21,7 @@ def self.from_hash(hash) new( foreign_key: hash[FOREIGN_KEY], direction: hash.fetch(DIRECTION).to_sym, + references: hash[REFERENCES] || "id", # TODO: Do we need this for backwards compatibility? Or do users always re-dump artifacts when they update? additional_filter: hash[ADDITIONAL_FILTER] || {}, foreign_key_nested_paths: hash[FOREIGN_KEY_NESTED_PATHS] || [] ) @@ -31,7 +33,8 @@ def to_dumpable_hash ADDITIONAL_FILTER => additional_filter, DIRECTION => direction.to_s, FOREIGN_KEY => foreign_key, - FOREIGN_KEY_NESTED_PATHS => foreign_key_nested_paths + FOREIGN_KEY_NESTED_PATHS => foreign_key_nested_paths, + REFERENCES => references } end end diff --git a/elasticgraph-schema_artifacts/sig/elastic_graph/schema_artifacts/runtime_metadata/relation.rbs b/elasticgraph-schema_artifacts/sig/elastic_graph/schema_artifacts/runtime_metadata/relation.rbs index c08b3799a..6683226f8 100644 --- a/elasticgraph-schema_artifacts/sig/elastic_graph/schema_artifacts/runtime_metadata/relation.rbs +++ b/elasticgraph-schema_artifacts/sig/elastic_graph/schema_artifacts/runtime_metadata/relation.rbs @@ -4,12 +4,14 @@ module ElasticGraph class RelationSupertype attr_reader foreign_key: ::String attr_reader direction: Relation::direction + attr_reader references: ::String attr_reader additional_filter: ::Hash[::String, untyped] attr_reader foreign_key_nested_paths: ::Array[::String] def initialize: ( foreign_key: ::String, direction: Relation::direction, + references: ::String, additional_filter: ::Hash[::String, untyped], foreign_key_nested_paths: ::Array[::String] ) -> void @@ -20,6 +22,7 @@ module ElasticGraph FOREIGN_KEY: "foreign_key" DIRECTION: "direction" + REFERENCES: "references" ADDITIONAL_FILTER: "additional_filter" FOREIGN_KEY_NESTED_PATHS: "foreign_key_nested_paths" def self.from_hash: (::Hash[::String, untyped]) -> Relation diff --git a/elasticgraph-schema_artifacts/spec/unit/elastic_graph/schema_artifacts/runtime_metadata/relation_spec.rb b/elasticgraph-schema_artifacts/spec/unit/elastic_graph/schema_artifacts/runtime_metadata/relation_spec.rb index f251d2b39..a07550d8d 100644 --- a/elasticgraph-schema_artifacts/spec/unit/elastic_graph/schema_artifacts/runtime_metadata/relation_spec.rb +++ b/elasticgraph-schema_artifacts/spec/unit/elastic_graph/schema_artifacts/runtime_metadata/relation_spec.rb @@ -21,6 +21,7 @@ module RuntimeMetadata expect(relation).to eq Relation.new( direction: :in, foreign_key: nil, + references: "id", additional_filter: {}, foreign_key_nested_paths: [] ) diff --git a/elasticgraph-schema_artifacts/spec/unit/elastic_graph/schema_artifacts/runtime_metadata/schema_spec.rb b/elasticgraph-schema_artifacts/spec/unit/elastic_graph/schema_artifacts/runtime_metadata/schema_spec.rb index 1b8041cbe..35c9fa836 100644 --- a/elasticgraph-schema_artifacts/spec/unit/elastic_graph/schema_artifacts/runtime_metadata/schema_spec.rb +++ b/elasticgraph-schema_artifacts/spec/unit/elastic_graph/schema_artifacts/runtime_metadata/schema_spec.rb @@ -69,6 +69,7 @@ module RuntimeMetadata relation: Relation.new( foreign_key: "grandparents.parents.some_id", direction: :out, + references: "id", additional_filter: {"flag_field" => {"equalToAnyOf" => [true]}}, foreign_key_nested_paths: ["grandparents", "grandparents.parents"] ), @@ -186,10 +187,11 @@ module RuntimeMetadata }, "parent" => { "relation" => { - "foreign_key" => "grandparents.parents.some_id", - "direction" => "out", "additional_filter" => {"flag_field" => {"equalToAnyOf" => [true]}}, - "foreign_key_nested_paths" => ["grandparents", "grandparents.parents"] + "direction" => "out", + "foreign_key" => "grandparents.parents.some_id", + "foreign_key_nested_paths" => ["grandparents", "grandparents.parents"], + "references" => "id" }, "resolver" => {"name" => "self"} }, diff --git a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/factory.rb b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/factory.rb index 067903eff..234f76e4b 100644 --- a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/factory.rb +++ b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/factory.rb @@ -267,13 +267,14 @@ def new_field_source(relationship_name:, field_path:) end @@field_source_new = prevent_non_factory_instantiation_of(SchemaElements::FieldSource) - def new_relationship(field, cardinality:, related_type:, foreign_key:, direction:) + def new_relationship(field, cardinality:, related_type:, foreign_key:, direction:, references:) @@relationship_new.call( field, cardinality: cardinality, related_type: related_type, foreign_key: foreign_key, - direction: direction + direction: direction, + references: references ) end @@relationship_new = prevent_non_factory_instantiation_of(SchemaElements::Relationship) diff --git a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/relationship_resolver.rb b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/relationship_resolver.rb index db2a68a61..5eed6a845 100644 --- a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/relationship_resolver.rb +++ b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/relationship_resolver.rb @@ -42,8 +42,12 @@ def resolve relation_metadata = relationship.runtime_metadata # : SchemaArtifacts::RuntimeMetadata::Relation foreign_key_parent_type = (relation_metadata.direction == :in) ? related_type : object_type + references_parent_type = (relation_metadata.direction == :in) ? object_type : related_type + if (foreign_key_error = validate_foreign_key(foreign_key_parent_type, relation_metadata)) [nil, foreign_key_error] + elsif (references_error = validate_references(references_parent_type, relation_metadata)) + [nil, references_error] else [ResolvedRelationship.new(relationship_name, relationship, related_type, relation_metadata), nil] end @@ -85,6 +89,24 @@ def validate_foreign_key(foreign_key_parent_type, relation_metadata) end end + def validate_references(references_parent_type, relation_metadata) + references_field = schema_def_state.field_path_resolver.resolve_public_path(references_parent_type, relation_metadata.references) { true } + # If it's an outbound relationship, verify that the references field exists on the related type. + # Note: we don't verify this for inbound relationships, because when we define a relationship with an inbound + # foreign key, we automatically define an indexing only field for the references field (since it exists on the + # same type). We don't do that for outbound relationships, though (since the references field exists on another + # type). Allowing a relationship definition on type A to add a field to type B's schema would be weird and surprising. + if relation_metadata.direction == :out && references_field.nil? + "#{relationship_error_prefix} uses `#{references_parent_type.name}.#{relation_metadata.references}` as the `references` field, " \ + "but that field does not exist as an indexing field. To continue, define it on `#{references_parent_type.name}`, " \ + "use another field as the `references` target, or remove the `#{relationship_description}` definition." + elsif references_field && references_field.type.fully_unwrapped.name != "ID" + "#{relationship_error_prefix} uses `#{references_field.fully_qualified_path}` as the `references` field, " \ + "but that field is not an `ID` field as expected. To continue, change its type, use another field " \ + "as the `references` target, or remove the `#{relationship_description}` definition." + end + end + def relationship_description "#{object_type.name}.#{relationship_name}" end diff --git a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/relationship.rb b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/relationship.rb index 29c7ec2f0..1350e2cc9 100644 --- a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/relationship.rb +++ b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/relationship.rb @@ -46,13 +46,14 @@ class Relationship < DelegateClass(Field) attr_accessor :hide_relationship_runtime_metadata # @private - def initialize(field, cardinality:, related_type:, foreign_key:, direction:) + def initialize(field, cardinality:, related_type:, foreign_key:, direction:, references:) super(field) self.hide_relationship_runtime_metadata = false @cardinality = cardinality @related_type = related_type @foreign_key = foreign_key @direction = direction + @references = references @equivalent_field_paths_by_local_path = {} @additional_filter = {} end @@ -205,6 +206,7 @@ def runtime_metadata SchemaArtifacts::RuntimeMetadata::Relation.new( foreign_key: @foreign_key, direction: @direction, + references: @references, additional_filter: @additional_filter, foreign_key_nested_paths: foreign_key_nested_paths ) diff --git a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/type_with_subfields.rb b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/type_with_subfields.rb index 4fc5f9c2f..feec84aea 100644 --- a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/type_with_subfields.rb +++ b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/type_with_subfields.rb @@ -359,8 +359,10 @@ def paginated_collection_field( # @param type [String] name of the related type # @param via [String] name of the foreign key field # @param dir [:in, :out] direction of the foreign key. Use `:in` for an inbound foreign key that resides on the related type and - # references the `id` of this type. Use `:out` for an outbound foreign key that resides on this type and references the `id` of - # the related type. + # references the identifier of this type. Use `:out` for an outbound foreign key that resides on this type and references the + # identifier of the related type. + # @param references [String] the field that the foreign key points to. Defaults to `"id"`. Use this when the target of the + # foreign key uses a different identifier field (e.g. `"guid"`). # @param indexing_only [Boolean] when true, the relationship is used only for indexing purposes (e.g. `sourced_from`) and will not # generate a GraphQL field. # @yield [Relationship] the generated relationship fields, for further customization @@ -385,9 +387,27 @@ def paginated_collection_field( # t.index "players" # end # end - def relates_to_one(field_name, type, via:, dir:, indexing_only: false, &block) + # + # @example Use `references` when the foreign key points to a field other than `id` + # ElasticGraph.define_schema do |schema| + # schema.object_type "Team" do |t| + # t.field "id", "ID" + # t.field "guid", "ID" + # t.field "name", "String" + # t.field "homeCity", "String" + # t.index "teams" + # end + # + # schema.object_type "Player" do |t| + # t.field "id", "ID" + # t.field "name", "String" + # t.relates_to_one "team", "Team", via: "teamGuid", references: "guid", dir: :out + # t.index "players" + # end + # end + def relates_to_one(field_name, type, via:, dir:, references: "id", indexing_only: false, &block) foreign_key_type = schema_def_state.type_ref(type).non_null? ? "ID!" : "ID" - relates_to(field_name, type, via: via, dir: dir, foreign_key_type: foreign_key_type, cardinality: :one, related_type: type, indexing_only: indexing_only, &block) + relates_to(field_name, type, via: via, dir: dir, references: references, foreign_key_type: foreign_key_type, cardinality: :one, related_type: type, indexing_only: indexing_only, &block) end # Defines a "has many" relationship between the current indexed type and another indexed type by defining a pair of fields clients @@ -399,8 +419,10 @@ def relates_to_one(field_name, type, via:, dir:, indexing_only: false, &block) # @param type [String] name of the related type # @param via [String] name of the foreign key field # @param dir [:in, :out] direction of the foreign key. Use `:in` for an inbound foreign key that resides on the related type and - # references the `id` of this type. Use `:out` for an outbound foreign key that resides on this type and references the `id` of - # the related type. + # references the identifier of this type. Use `:out` for an outbound foreign key that resides on this type and references the + # identifier of the related type. + # @param references [String] the field that the foreign key points to. Defaults to `"id"`. Use this when the target of the + # foreign key uses a different identifier field (e.g. `"guid"`). # @param singular [String] singular form of the `field_name`; will be used (along with an `Aggregations` suffix) for the name of # the generated aggregations field. Not required when `indexing_only: true`. # @param indexing_only [Boolean] when true, the relationship is used only for indexing purposes (e.g. `sourced_from`) and will not @@ -429,7 +451,26 @@ def relates_to_one(field_name, type, via:, dir:, indexing_only: false, &block) # t.index "players" # end # end - def relates_to_many(field_name, type, via:, dir:, singular: nil, indexing_only: false) + # + # @example Use `references` when the foreign key points to a field other than `id` + # ElasticGraph.define_schema do |schema| + # schema.object_type "Team" do |t| + # t.field "id", "ID" + # t.field "guid", "ID" + # t.field "name", "String" + # t.field "homeCity", "String" + # t.relates_to_many "players", "Player", via: "teamGuid", references: "guid", dir: :in, singular: "player" + # t.index "teams" + # end + # + # schema.object_type "Player" do |t| + # t.field "id", "ID" + # t.field "name", "String" + # t.field "teamGuid", "ID" + # t.index "players" + # end + # end + def relates_to_many(field_name, type, via:, dir:, references: "id", singular: nil, indexing_only: false) foreign_key_type = (dir == :out) ? "[ID!]!" : "ID" if singular.nil? && !indexing_only @@ -438,7 +479,7 @@ def relates_to_many(field_name, type, via:, dir:, singular: nil, indexing_only: type_ref = schema_def_state.type_ref(type).to_final_form - relates_to(field_name, type_ref.as_connection.name, via: via, dir: dir, foreign_key_type: foreign_key_type, cardinality: :many, related_type: type, indexing_only: indexing_only) do |f| + relates_to(field_name, type_ref.as_connection.name, via: via, dir: dir, references: references, foreign_key_type: foreign_key_type, cardinality: :many, related_type: type, indexing_only: indexing_only) do |f| f.argument schema_def_state.schema_elements.filter, type_ref.as_filter_input.name do |a| a.documentation "Used to filter the returned `#{field_name}` based on the provided criteria." end @@ -454,7 +495,7 @@ def relates_to_many(field_name, type, via:, dir:, singular: nil, indexing_only: unless indexing_only aggregations_name = schema_def_state.schema_elements.normalize_case("#{singular}_aggregations") - relates_to(aggregations_name, type_ref.as_aggregation.as_connection.name, via: via, dir: dir, foreign_key_type: foreign_key_type, cardinality: :many, related_type: type) do |f| + relates_to(aggregations_name, type_ref.as_aggregation.as_connection.name, via: via, dir: dir, references: references, foreign_key_type: foreign_key_type, cardinality: :many, related_type: type) do |f| f.argument schema_def_state.schema_elements.filter, type_ref.as_filter_input.name do |a| a.documentation "Used to filter the `#{type}` documents that get aggregated over based on the provided criteria." end @@ -567,14 +608,15 @@ def register_field(name, field, registry, registry_type, only_option_to_fix, &to registry[name] = field end - def relates_to(field_name, type, via:, dir:, foreign_key_type:, cardinality:, related_type:, indexing_only: false) + def relates_to(field_name, type, via:, dir:, references:, foreign_key_type:, cardinality:, related_type:, indexing_only: false) field(field_name, type, sortable: false, filterable: false, groupable: false, graphql_only: true, indexing_only: indexing_only) do |field| relationship = schema_def_state.factory.new_relationship( field, cardinality: cardinality, related_type: schema_def_state.type_ref(related_type).to_final_form, foreign_key: via, - direction: dir + direction: dir, + references: references ) field.relationship = relationship @@ -583,9 +625,9 @@ def relates_to(field_name, type, via:, dir:, foreign_key_type:, cardinality:, re yield relationship if block_given? if dir == :out - register_inferred_foreign_key_fields(from_type: [via, foreign_key_type], to_other: ["id", "ID!"], related_type: relationship.related_type) + register_inferred_foreign_key_fields(from_type: [via, foreign_key_type], to_other: [references, "ID!"], related_type: relationship.related_type) else - register_inferred_foreign_key_fields(from_type: ["id", "ID!"], to_other: [via, foreign_key_type], related_type: relationship.related_type) + register_inferred_foreign_key_fields(from_type: [references, "ID!"], to_other: [via, foreign_key_type], related_type: relationship.related_type) end if relationships_by_name.key?(field_name) diff --git a/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/factory.rbs b/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/factory.rbs index 9e5c6ac52..89e76215e 100644 --- a/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/factory.rbs +++ b/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/factory.rbs @@ -109,7 +109,8 @@ module ElasticGraph cardinality: SchemaElements::Relationship::cardinality, related_type: SchemaElements::TypeReference, foreign_key: ::String, - direction: SchemaElements::foreignKeyDirection + direction: SchemaElements::foreignKeyDirection, + references: ::String ) -> SchemaElements::Relationship @@relationship_new: ::Method diff --git a/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/indexing/relationship_resolver.rbs b/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/indexing/relationship_resolver.rbs index ad8800f52..9032370d9 100644 --- a/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/indexing/relationship_resolver.rbs +++ b/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/indexing/relationship_resolver.rbs @@ -23,6 +23,10 @@ module ElasticGraph indexableType, SchemaArtifacts::RuntimeMetadata::Relation ) -> ::String? + def validate_references: ( + indexableType, + SchemaArtifacts::RuntimeMetadata::Relation + ) -> ::String? def relationship_description: () -> ::String end diff --git a/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/schema_elements/relationship.rbs b/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/schema_elements/relationship.rbs index ee1d03122..0610552d0 100644 --- a/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/schema_elements/relationship.rbs +++ b/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/schema_elements/relationship.rbs @@ -14,6 +14,7 @@ module ElasticGraph @related_type: TypeReference @foreign_key: ::String @direction: foreignKeyDirection + @references: ::String @equivalent_field_paths_by_local_path: ::Hash[::String, ::String] @additional_filter: ::Hash[::String, untyped] @@ -22,7 +23,8 @@ module ElasticGraph cardinality: cardinality, related_type: TypeReference, foreign_key: ::String, - direction: foreignKeyDirection + direction: foreignKeyDirection, + references: ::String ) -> void def additional_filter: (::Hash[::String, untyped]) -> void diff --git a/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/schema_elements/type_with_subfields.rbs b/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/schema_elements/type_with_subfields.rbs index 9dc88ff72..7bf04b9ad 100644 --- a/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/schema_elements/type_with_subfields.rbs +++ b/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/schema_elements/type_with_subfields.rbs @@ -78,8 +78,8 @@ module ElasticGraph ?highlightable: bool? ) ?{ (Field) -> void } -> Field - def relates_to_one: (::String, ::String, via: ::String, dir: foreignKeyDirection, ?indexing_only: bool) ?{ (Relationship) -> void } -> void - def relates_to_many: (::String, ::String, via: ::String, dir: foreignKeyDirection, ?singular: ::String?, ?indexing_only: bool) ?{ (Relationship) -> void } -> void + def relates_to_one: (::String, ::String, via: ::String, dir: foreignKeyDirection, ?references: ::String, ?indexing_only: bool) ?{ (Relationship) -> void } -> void + def relates_to_many: (::String, ::String, via: ::String, dir: foreignKeyDirection, ?references: ::String, ?singular: ::String?, ?indexing_only: bool) ?{ (Relationship) -> void } -> void def generate_sdl: (name_section: ::String) ?{ (Field::argument) -> boolish } -> String def current_sources: () -> ::Array[::String] @@ -106,6 +106,7 @@ module ElasticGraph ::String, via: ::String, dir: foreignKeyDirection, + references: ::String, foreign_key_type: ::String, cardinality: Relationship::cardinality, related_type: ::String, diff --git a/elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/runtime_metadata/object_types_by_name/relation_metadata_spec.rb b/elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/runtime_metadata/object_types_by_name/relation_metadata_spec.rb index fff3e54ae..74ac60154 100644 --- a/elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/runtime_metadata/object_types_by_name/relation_metadata_spec.rb +++ b/elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/runtime_metadata/object_types_by_name/relation_metadata_spec.rb @@ -29,6 +29,7 @@ module SchemaDefinition relation: SchemaArtifacts::RuntimeMetadata::Relation.new( foreign_key: "parent_id", direction: :out, + references: "id", additional_filter: {}, foreign_key_nested_paths: [] ) @@ -50,6 +51,7 @@ module SchemaDefinition relation: SchemaArtifacts::RuntimeMetadata::Relation.new( foreign_key: "parent_id", direction: :in, + references: "id", additional_filter: {}, foreign_key_nested_paths: [] ) @@ -85,6 +87,7 @@ module SchemaDefinition relation: SchemaArtifacts::RuntimeMetadata::Relation.new( foreign_key: "parent_id", direction: :in, + references: "id", additional_filter: filter, foreign_key_nested_paths: [] ) @@ -121,6 +124,7 @@ module SchemaDefinition relation: SchemaArtifacts::RuntimeMetadata::Relation.new( foreign_key: "parent_id", direction: :in, + references: "id", additional_filter: {"is_enabled" => {"equal_to_any_of" => [true]}}, foreign_key_nested_paths: [] ) @@ -166,6 +170,7 @@ module SchemaDefinition relation: SchemaArtifacts::RuntimeMetadata::Relation.new( foreign_key: "parent_id", direction: :in, + references: "id", additional_filter: { "is_enabled" => {"equal_to_any_of" => [true]}, "details" => {"foo" => {"lt" => 3}, "bar" => {"gt" => 5}}, @@ -247,6 +252,7 @@ def test_foreign_key_nested_paths(type_definition_order) relation: SchemaArtifacts::RuntimeMetadata::Relation.new( foreign_key: "players.affiliations.sponsorships.sponsor_id", direction: :in, + references: "id", additional_filter: {}, foreign_key_nested_paths: ["players", "players.affiliations.sponsorships"] ) @@ -258,6 +264,35 @@ def test_foreign_key_nested_paths(type_definition_order) end end + describe "references parameter" do + it "includes a custom references value in relation metadata" do + metadata = object_type_metadata_for "Widget" do |s| + s.object_type "Widget" do |t| + t.field "id", "ID" + t.field "guid", "ID" + t.relates_to_many "children", "Widget", via: "parent_guid", dir: :in, references: "guid", singular: "child" + t.index "widgets" + end + end + + expected_relation_field = graphql_field_with( + resolver: configured_graphql_resolver(:nested_relationships), + relation: SchemaArtifacts::RuntimeMetadata::Relation.new( + foreign_key: "parent_guid", + direction: :in, + references: "guid", + additional_filter: {}, + foreign_key_nested_paths: [] + ) + ) + + expect(metadata.graphql_fields_by_name.slice("children", "child_aggregations")).to eq({ + "children" => expected_relation_field.with(name_in_index: "children"), + "child_aggregations" => expected_relation_field.with(name_in_index: "child_aggregations") + }) + end + end + describe "indexing_only relationships" do it "excludes `indexing_only: true` relationships from graphql_fields_by_name in runtime metadata" do metadata = object_type_metadata_for "Widget" do |s| diff --git a/elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/runtime_metadata/object_types_by_name/update_targets_spec.rb b/elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/runtime_metadata/object_types_by_name/update_targets_spec.rb index f5572f586..fd14b9fb4 100644 --- a/elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/runtime_metadata/object_types_by_name/update_targets_spec.rb +++ b/elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/runtime_metadata/object_types_by_name/update_targets_spec.rb @@ -861,6 +861,68 @@ def expect_widget_update_target_with( }.not_to raise_error end + it "raises an error if an inbound references field is not an `ID`, regardless of whether there are any `sourced_from` fields or not" do + expect { + update_targets_for("Widget") do |t| + t.field "numeric_id", "Int" + t.relates_to_one "workspace", "WidgetWorkspace", via: "widget_ids", dir: :in, references: "numeric_id" + + t.field "workspace_name", "String" do |f| + f.sourced_from "workspace", "name" + end + + t.field "workspace_created_at", "DateTime" do |f| + f.sourced_from "workspace", "created_at" + end + end + }.to raise_error_about_workspace_relationship( + "uses `Widget.numeric_id` as the `references` field, but that field is not an `ID` field as expected." + ) + + expect { + update_targets_for("Widget") do |t| + t.field "numeric_id", "Int" + t.relates_to_one "workspace", "WidgetWorkspace", via: "widget_ids", dir: :in, references: "numeric_id" + expect(t.fields_with_sources).to be_empty + end + }.to raise_error_about_workspace_relationship( + "uses `Widget.numeric_id` as the `references` field, but that field is not an `ID` field as expected.", + sourced_fields: false + ) + end + + it "raises an error if an outbound references field does not exist on the related type" do + expect { + update_targets_for("Widget", on_widget_workspace_type: ->(t) { + t.relates_to_one "widget", "Widget", via: "widget_id", dir: :out, references: "guid" + }) + }.to raise_error Errors::SchemaError, a_string_including( + "`WidgetWorkspace.widget` uses `Widget.guid` as the `references` field, but that field does not exist as an indexing field." + ) + end + + it "raises an error if an outbound references field is not an `ID`" do + expect { + update_targets_for("Widget") do |t| + t.relates_to_one "workspace", "WidgetWorkspace", via: "workspace_id", dir: :out, references: "name" + end + }.to raise_error Errors::SchemaError, a_string_including( + "`Widget.workspace` uses `WidgetWorkspace.name` as the `references` field, but that field is not an `ID` field as expected." + ) + end + + it "does not raise an error if the inbound references field is inferred instead of explicitly defined" do + expect { + update_targets_for("Widget", on_widget_workspace_type: ->(t) { t.field "widget_guid", "ID" }) do |t| + t.relates_to_one "workspace", "WidgetWorkspace", via: "widget_guid", dir: :in, references: "guid" + + t.field "workspace_name", "String" do |f| + f.sourced_from "workspace", "name" + end + end + }.not_to raise_error + end + it "allows a foreign key whose type is nested inside of an `object` array" do expect { object_type_metadata_for "WidgetWorkspace" do |s| diff --git a/spec_support/lib/elastic_graph/spec_support/factories/widgets.rb b/spec_support/lib/elastic_graph/spec_support/factories/widgets.rb index df0b6f379..3c094eab6 100644 --- a/spec_support/lib/elastic_graph/spec_support/factories/widgets.rb +++ b/spec_support/lib/elastic_graph/spec_support/factories/widgets.rb @@ -151,6 +151,7 @@ factory :manufacturer, parent: :indexed_type do __typename { "Manufacturer" } + guid { Faker::Alphanumeric.alpha(number: 20) } name { Faker::Company.name } created_at { Faker::Time.between(from: recent_date - 30, to: recent_date).utc.iso8601 } ceo { build(:person).as_embedded } @@ -190,6 +191,7 @@ factory :mechanical_part do __typename { "MechanicalPart" } + manufacturer_guid { manufacturer&.fetch(:guid) } material { Faker::Base.sample(["ALLOY", "CARBON_FIBER"]) } end end diff --git a/spec_support/lib/elastic_graph/spec_support/runtime_metadata_support.rb b/spec_support/lib/elastic_graph/spec_support/runtime_metadata_support.rb index 29316874b..ad8df794b 100644 --- a/spec_support/lib/elastic_graph/spec_support/runtime_metadata_support.rb +++ b/spec_support/lib/elastic_graph/spec_support/runtime_metadata_support.rb @@ -152,8 +152,8 @@ def sort_field_with(field_path: "path.to.some.field", direction: :asc) ) end - def relation_with(foreign_key: "some_id", direction: :asc, additional_filter: {}, foreign_key_nested_paths: []) - Relation.new(foreign_key: foreign_key, direction: direction, additional_filter: additional_filter, foreign_key_nested_paths: foreign_key_nested_paths) + def relation_with(foreign_key: "some_id", direction: :asc, references: "id", additional_filter: {}, foreign_key_nested_paths: []) + Relation.new(foreign_key: foreign_key, direction: direction, references: references, additional_filter: additional_filter, foreign_key_nested_paths: foreign_key_nested_paths) end def graphql_field_with(name_in_index: "name_index", relation: nil, computation_detail: nil, resolver: nil) From 2d04f606f3bb65b621571a53e1fa2a2fef72cae7 Mon Sep 17 00:00:00 2001 From: ellisandrews-toast Date: Mon, 18 May 2026 21:44:13 -0400 Subject: [PATCH 2/6] Rename references to referenced_field_name internally --- config/schema/artifacts/runtime_metadata.yaml | 94 +++++++++--------- .../runtime_metadata.yaml | 98 +++++++++---------- .../graphql/schema/relation_join.rb | 8 +- .../runtime_metadata/relation.rb | 8 +- .../runtime_metadata/relation.rbs | 6 +- .../runtime_metadata/relation_spec.rb | 4 +- .../runtime_metadata/schema_spec.rb | 4 +- .../schema_definition/factory.rb | 4 +- .../indexing/relationship_resolver.rb | 26 ++--- .../schema_elements/relationship.rb | 6 +- .../schema_elements/type_with_subfields.rb | 14 +-- .../schema_definition/factory.rbs | 2 +- .../indexing/relationship_resolver.rbs | 2 +- .../schema_elements/relationship.rbs | 4 +- .../schema_elements/type_with_subfields.rbs | 2 +- .../relation_metadata_spec.rb | 14 +-- .../spec_support/runtime_metadata_support.rb | 4 +- 17 files changed, 150 insertions(+), 150 deletions(-) diff --git a/config/schema/artifacts/runtime_metadata.yaml b/config/schema/artifacts/runtime_metadata.yaml index 6b6c84014..962e280c8 100644 --- a/config/schema/artifacts/runtime_metadata.yaml +++ b/config/schema/artifacts/runtime_metadata.yaml @@ -3075,7 +3075,7 @@ object_types_by_name: relation: direction: out foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships shapes: @@ -3353,7 +3353,7 @@ object_types_by_name: - 100 direction: in foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships id: @@ -3366,14 +3366,14 @@ object_types_by_name: relation: direction: out foreign_key: part_ids - references: id + referenced_field_name: id resolver: name: nested_relationships parts: relation: direction: out foreign_key: part_ids - references: id + referenced_field_name: id resolver: name: nested_relationships position: @@ -3386,14 +3386,14 @@ object_types_by_name: relation: direction: in foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships widget_aggregations: relation: direction: in foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships widget_cost: @@ -3416,7 +3416,7 @@ object_types_by_name: relation: direction: in foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships index_definition_names: @@ -3876,14 +3876,14 @@ object_types_by_name: relation: direction: in foreign_key: part_ids - references: id + referenced_field_name: id resolver: name: nested_relationships components: relation: direction: in foreign_key: part_ids - references: id + referenced_field_name: id resolver: name: nested_relationships created_at: @@ -3896,7 +3896,7 @@ object_types_by_name: relation: direction: out foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships name: @@ -4364,7 +4364,7 @@ object_types_by_name: relation: direction: in foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships ceo: @@ -4383,28 +4383,28 @@ object_types_by_name: relation: direction: in foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships manufactured_parts: relation: direction: in foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships mechanical_part_aggregations: relation: direction: in foreign_key: manufacturer_guid - references: guid + referenced_field_name: guid resolver: name: nested_relationships mechanical_parts: relation: direction: in foreign_key: manufacturer_guid - references: guid + referenced_field_name: guid resolver: name: nested_relationships name: @@ -4553,14 +4553,14 @@ object_types_by_name: relation: direction: in foreign_key: part_ids - references: id + referenced_field_name: id resolver: name: nested_relationships components: relation: direction: in foreign_key: part_ids - references: id + referenced_field_name: id resolver: name: nested_relationships created_at: @@ -4573,14 +4573,14 @@ object_types_by_name: relation: direction: out foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships manufacturer_by_guid: relation: direction: out foreign_key: manufacturer_guid - references: guid + referenced_field_name: guid resolver: name: nested_relationships material: @@ -4762,7 +4762,7 @@ object_types_by_name: relation: direction: in foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships amount_cents: @@ -4782,14 +4782,14 @@ object_types_by_name: relation: direction: out foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships components: relation: direction: out foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships cost: @@ -4835,7 +4835,7 @@ object_types_by_name: - 100 direction: in foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships fees: @@ -4866,28 +4866,28 @@ object_types_by_name: relation: direction: in foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships manufactured_parts: relation: direction: in foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships manufacturer: relation: direction: out foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships manufacturer_by_guid: relation: direction: out foreign_key: manufacturer_guid - references: guid + referenced_field_name: guid resolver: name: nested_relationships material: @@ -4897,14 +4897,14 @@ object_types_by_name: relation: direction: in foreign_key: manufacturer_guid - references: guid + referenced_field_name: guid resolver: name: nested_relationships mechanical_parts: relation: direction: in foreign_key: manufacturer_guid - references: guid + referenced_field_name: guid resolver: name: nested_relationships metadata: @@ -4926,14 +4926,14 @@ object_types_by_name: relation: direction: out foreign_key: part_ids - references: id + referenced_field_name: id resolver: name: nested_relationships parts: relation: direction: out foreign_key: part_ids - references: id + referenced_field_name: id resolver: name: nested_relationships position: @@ -4969,14 +4969,14 @@ object_types_by_name: relation: direction: in foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships widget_aggregations: relation: direction: in foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships widget_cost: @@ -4999,7 +4999,7 @@ object_types_by_name: relation: direction: in foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships workspace_id: @@ -5646,14 +5646,14 @@ object_types_by_name: relation: direction: in foreign_key: part_ids - references: id + referenced_field_name: id resolver: name: nested_relationships components: relation: direction: in foreign_key: part_ids - references: id + referenced_field_name: id resolver: name: nested_relationships created_at: @@ -5666,14 +5666,14 @@ object_types_by_name: relation: direction: out foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships manufacturer_by_guid: relation: direction: out foreign_key: manufacturer_guid - references: guid + referenced_field_name: guid resolver: name: nested_relationships material: @@ -6380,14 +6380,14 @@ object_types_by_name: foreign_key_nested_paths: - current_players_nested - current_players_nested.affiliations.sponsorships_nested - references: id + referenced_field_name: id resolver: name: nested_relationships affiliated_team_from_object_aggregations: relation: direction: in foreign_key: current_players_object.affiliations.sponsorships_object.sponsor_id - references: id + referenced_field_name: id resolver: name: nested_relationships affiliated_teams_from_nested: @@ -6397,14 +6397,14 @@ object_types_by_name: foreign_key_nested_paths: - current_players_nested - current_players_nested.affiliations.sponsorships_nested - references: id + referenced_field_name: id resolver: name: nested_relationships affiliated_teams_from_object: relation: direction: in foreign_key: current_players_object.affiliations.sponsorships_object.sponsor_id - references: id + referenced_field_name: id resolver: name: nested_relationships id: @@ -7722,14 +7722,14 @@ object_types_by_name: relation: direction: out foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships components: relation: direction: out foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships cost: @@ -8705,14 +8705,14 @@ object_types_by_name: relation: direction: out foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships components: relation: direction: out foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships cost: @@ -8780,7 +8780,7 @@ object_types_by_name: relation: direction: out foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships metadata: diff --git a/config/schema/artifacts_with_apollo/runtime_metadata.yaml b/config/schema/artifacts_with_apollo/runtime_metadata.yaml index e2372579f..7c63c72b7 100644 --- a/config/schema/artifacts_with_apollo/runtime_metadata.yaml +++ b/config/schema/artifacts_with_apollo/runtime_metadata.yaml @@ -3104,7 +3104,7 @@ object_types_by_name: relation: direction: out foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships shapes: @@ -3382,7 +3382,7 @@ object_types_by_name: - 100 direction: in foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships id: @@ -3416,14 +3416,14 @@ object_types_by_name: relation: direction: out foreign_key: part_ids - references: id + referenced_field_name: id resolver: name: nested_relationships parts: relation: direction: out foreign_key: part_ids - references: id + referenced_field_name: id resolver: name: nested_relationships position: @@ -3436,14 +3436,14 @@ object_types_by_name: relation: direction: in foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships widget_aggregations: relation: direction: in foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships widget_cost: @@ -3466,7 +3466,7 @@ object_types_by_name: relation: direction: in foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships index_definition_names: @@ -3699,14 +3699,14 @@ object_types_by_name: relation: direction: in foreign_key: country_code - references: id + referenced_field_name: id resolver: name: nested_relationships teams: relation: direction: in foreign_key: country_code - references: id + referenced_field_name: id resolver: name: nested_relationships CurrencyDetails: @@ -3980,14 +3980,14 @@ object_types_by_name: relation: direction: in foreign_key: part_ids - references: id + referenced_field_name: id resolver: name: nested_relationships components: relation: direction: in foreign_key: part_ids - references: id + referenced_field_name: id resolver: name: nested_relationships created_at: @@ -4000,7 +4000,7 @@ object_types_by_name: relation: direction: out foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships name: @@ -4468,7 +4468,7 @@ object_types_by_name: relation: direction: in foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships ceo: @@ -4487,28 +4487,28 @@ object_types_by_name: relation: direction: in foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships manufactured_parts: relation: direction: in foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships mechanical_part_aggregations: relation: direction: in foreign_key: manufacturer_guid - references: guid + referenced_field_name: guid resolver: name: nested_relationships mechanical_parts: relation: direction: in foreign_key: manufacturer_guid - references: guid + referenced_field_name: guid resolver: name: nested_relationships name: @@ -4657,14 +4657,14 @@ object_types_by_name: relation: direction: in foreign_key: part_ids - references: id + referenced_field_name: id resolver: name: nested_relationships components: relation: direction: in foreign_key: part_ids - references: id + referenced_field_name: id resolver: name: nested_relationships created_at: @@ -4677,14 +4677,14 @@ object_types_by_name: relation: direction: out foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships manufacturer_by_guid: relation: direction: out foreign_key: manufacturer_guid - references: guid + referenced_field_name: guid resolver: name: nested_relationships material: @@ -4866,7 +4866,7 @@ object_types_by_name: relation: direction: in foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships amount_cents: @@ -4886,14 +4886,14 @@ object_types_by_name: relation: direction: out foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships components: relation: direction: out foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships cost: @@ -4939,7 +4939,7 @@ object_types_by_name: - 100 direction: in foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships fees: @@ -4970,28 +4970,28 @@ object_types_by_name: relation: direction: in foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships manufactured_parts: relation: direction: in foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships manufacturer: relation: direction: out foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships manufacturer_by_guid: relation: direction: out foreign_key: manufacturer_guid - references: guid + referenced_field_name: guid resolver: name: nested_relationships material: @@ -5001,14 +5001,14 @@ object_types_by_name: relation: direction: in foreign_key: manufacturer_guid - references: guid + referenced_field_name: guid resolver: name: nested_relationships mechanical_parts: relation: direction: in foreign_key: manufacturer_guid - references: guid + referenced_field_name: guid resolver: name: nested_relationships metadata: @@ -5051,14 +5051,14 @@ object_types_by_name: relation: direction: out foreign_key: part_ids - references: id + referenced_field_name: id resolver: name: nested_relationships parts: relation: direction: out foreign_key: part_ids - references: id + referenced_field_name: id resolver: name: nested_relationships position: @@ -5094,14 +5094,14 @@ object_types_by_name: relation: direction: in foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships widget_aggregations: relation: direction: in foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships widget_cost: @@ -5124,7 +5124,7 @@ object_types_by_name: relation: direction: in foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships workspace_id: @@ -5771,14 +5771,14 @@ object_types_by_name: relation: direction: in foreign_key: part_ids - references: id + referenced_field_name: id resolver: name: nested_relationships components: relation: direction: in foreign_key: part_ids - references: id + referenced_field_name: id resolver: name: nested_relationships created_at: @@ -5791,14 +5791,14 @@ object_types_by_name: relation: direction: out foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships manufacturer_by_guid: relation: direction: out foreign_key: manufacturer_guid - references: guid + referenced_field_name: guid resolver: name: nested_relationships material: @@ -6511,14 +6511,14 @@ object_types_by_name: foreign_key_nested_paths: - current_players_nested - current_players_nested.affiliations.sponsorships_nested - references: id + referenced_field_name: id resolver: name: nested_relationships affiliated_team_from_object_aggregations: relation: direction: in foreign_key: current_players_object.affiliations.sponsorships_object.sponsor_id - references: id + referenced_field_name: id resolver: name: nested_relationships affiliated_teams_from_nested: @@ -6528,14 +6528,14 @@ object_types_by_name: foreign_key_nested_paths: - current_players_nested - current_players_nested.affiliations.sponsorships_nested - references: id + referenced_field_name: id resolver: name: nested_relationships affiliated_teams_from_object: relation: direction: in foreign_key: current_players_object.affiliations.sponsorships_object.sponsor_id - references: id + referenced_field_name: id resolver: name: nested_relationships id: @@ -7853,14 +7853,14 @@ object_types_by_name: relation: direction: out foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships components: relation: direction: out foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships cost: @@ -8836,14 +8836,14 @@ object_types_by_name: relation: direction: out foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships components: relation: direction: out foreign_key: component_ids - references: id + referenced_field_name: id resolver: name: nested_relationships cost: @@ -8911,7 +8911,7 @@ object_types_by_name: relation: direction: out foreign_key: manufacturer_id - references: id + referenced_field_name: id resolver: name: nested_relationships metadata: diff --git a/elasticgraph-graphql/lib/elastic_graph/graphql/schema/relation_join.rb b/elasticgraph-graphql/lib/elastic_graph/graphql/schema/relation_join.rb index 485a2f081..b7c5ab0db 100644 --- a/elasticgraph-graphql/lib/elastic_graph/graphql/schema/relation_join.rb +++ b/elasticgraph-graphql/lib/elastic_graph/graphql/schema/relation_join.rb @@ -33,15 +33,15 @@ def self.from(field) if relation.direction == :in # An inbound foreign key has some field (such as `foo_id`) on another document that points - # back to the `references` field on the document with the relation. + # back to the `referenced_field_name` field on the document with the relation. # # The cardinality of the referenced field on an inbound relation is always 1 since # it is expected to be a unique identifier field. - new(field, relation.references, relation.foreign_key, Cardinality::One, doc_cardinality, relation.additional_filter, relation.foreign_key_nested_paths) + new(field, relation.referenced_field_name, relation.foreign_key, Cardinality::One, doc_cardinality, relation.additional_filter, relation.foreign_key_nested_paths) else # An outbound foreign key has some field (such as `foo_id`) on the document with the relation - # that points out to the `references` field of another document. - new(field, relation.foreign_key, relation.references, doc_cardinality, doc_cardinality, relation.additional_filter, relation.foreign_key_nested_paths) + # that points out to the `referenced_field_name` field of another document. + new(field, relation.foreign_key, relation.referenced_field_name, doc_cardinality, doc_cardinality, relation.additional_filter, relation.foreign_key_nested_paths) end end diff --git a/elasticgraph-schema_artifacts/lib/elastic_graph/schema_artifacts/runtime_metadata/relation.rb b/elasticgraph-schema_artifacts/lib/elastic_graph/schema_artifacts/runtime_metadata/relation.rb index 3a246b015..9810e0869 100644 --- a/elasticgraph-schema_artifacts/lib/elastic_graph/schema_artifacts/runtime_metadata/relation.rb +++ b/elasticgraph-schema_artifacts/lib/elastic_graph/schema_artifacts/runtime_metadata/relation.rb @@ -10,10 +10,10 @@ module ElasticGraph module SchemaArtifacts module RuntimeMetadata # @private - class Relation < ::Data.define(:foreign_key, :direction, :references, :additional_filter, :foreign_key_nested_paths) + class Relation < ::Data.define(:foreign_key, :direction, :referenced_field_name, :additional_filter, :foreign_key_nested_paths) FOREIGN_KEY = "foreign_key" DIRECTION = "direction" - REFERENCES = "references" + REFERENCED_FIELD_NAME = "referenced_field_name" ADDITIONAL_FILTER = "additional_filter" FOREIGN_KEY_NESTED_PATHS = "foreign_key_nested_paths" @@ -21,7 +21,7 @@ def self.from_hash(hash) new( foreign_key: hash[FOREIGN_KEY], direction: hash.fetch(DIRECTION).to_sym, - references: hash[REFERENCES] || "id", # TODO: Do we need this for backwards compatibility? Or do users always re-dump artifacts when they update? + referenced_field_name: hash[REFERENCED_FIELD_NAME], additional_filter: hash[ADDITIONAL_FILTER] || {}, foreign_key_nested_paths: hash[FOREIGN_KEY_NESTED_PATHS] || [] ) @@ -34,7 +34,7 @@ def to_dumpable_hash DIRECTION => direction.to_s, FOREIGN_KEY => foreign_key, FOREIGN_KEY_NESTED_PATHS => foreign_key_nested_paths, - REFERENCES => references + REFERENCED_FIELD_NAME => referenced_field_name } end end diff --git a/elasticgraph-schema_artifacts/sig/elastic_graph/schema_artifacts/runtime_metadata/relation.rbs b/elasticgraph-schema_artifacts/sig/elastic_graph/schema_artifacts/runtime_metadata/relation.rbs index 6683226f8..0258b0121 100644 --- a/elasticgraph-schema_artifacts/sig/elastic_graph/schema_artifacts/runtime_metadata/relation.rbs +++ b/elasticgraph-schema_artifacts/sig/elastic_graph/schema_artifacts/runtime_metadata/relation.rbs @@ -4,14 +4,14 @@ module ElasticGraph class RelationSupertype attr_reader foreign_key: ::String attr_reader direction: Relation::direction - attr_reader references: ::String + attr_reader referenced_field_name: ::String attr_reader additional_filter: ::Hash[::String, untyped] attr_reader foreign_key_nested_paths: ::Array[::String] def initialize: ( foreign_key: ::String, direction: Relation::direction, - references: ::String, + referenced_field_name: ::String, additional_filter: ::Hash[::String, untyped], foreign_key_nested_paths: ::Array[::String] ) -> void @@ -22,7 +22,7 @@ module ElasticGraph FOREIGN_KEY: "foreign_key" DIRECTION: "direction" - REFERENCES: "references" + REFERENCED_FIELD_NAME: "referenced_field_name" ADDITIONAL_FILTER: "additional_filter" FOREIGN_KEY_NESTED_PATHS: "foreign_key_nested_paths" def self.from_hash: (::Hash[::String, untyped]) -> Relation diff --git a/elasticgraph-schema_artifacts/spec/unit/elastic_graph/schema_artifacts/runtime_metadata/relation_spec.rb b/elasticgraph-schema_artifacts/spec/unit/elastic_graph/schema_artifacts/runtime_metadata/relation_spec.rb index a07550d8d..19efdc280 100644 --- a/elasticgraph-schema_artifacts/spec/unit/elastic_graph/schema_artifacts/runtime_metadata/relation_spec.rb +++ b/elasticgraph-schema_artifacts/spec/unit/elastic_graph/schema_artifacts/runtime_metadata/relation_spec.rb @@ -16,12 +16,12 @@ module RuntimeMetadata include RuntimeMetadataSupport it "builds from a minimal hash" do - relation = Relation.from_hash({"direction" => "in"}) + relation = Relation.from_hash({"direction" => "in", "referenced_field_name" => "id"}) expect(relation).to eq Relation.new( direction: :in, foreign_key: nil, - references: "id", + referenced_field_name: "id", additional_filter: {}, foreign_key_nested_paths: [] ) diff --git a/elasticgraph-schema_artifacts/spec/unit/elastic_graph/schema_artifacts/runtime_metadata/schema_spec.rb b/elasticgraph-schema_artifacts/spec/unit/elastic_graph/schema_artifacts/runtime_metadata/schema_spec.rb index 35c9fa836..c4930c878 100644 --- a/elasticgraph-schema_artifacts/spec/unit/elastic_graph/schema_artifacts/runtime_metadata/schema_spec.rb +++ b/elasticgraph-schema_artifacts/spec/unit/elastic_graph/schema_artifacts/runtime_metadata/schema_spec.rb @@ -69,7 +69,7 @@ module RuntimeMetadata relation: Relation.new( foreign_key: "grandparents.parents.some_id", direction: :out, - references: "id", + referenced_field_name: "id", additional_filter: {"flag_field" => {"equalToAnyOf" => [true]}}, foreign_key_nested_paths: ["grandparents", "grandparents.parents"] ), @@ -191,7 +191,7 @@ module RuntimeMetadata "direction" => "out", "foreign_key" => "grandparents.parents.some_id", "foreign_key_nested_paths" => ["grandparents", "grandparents.parents"], - "references" => "id" + "referenced_field_name" => "id" }, "resolver" => {"name" => "self"} }, diff --git a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/factory.rb b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/factory.rb index 234f76e4b..81e7b6fde 100644 --- a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/factory.rb +++ b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/factory.rb @@ -267,14 +267,14 @@ def new_field_source(relationship_name:, field_path:) end @@field_source_new = prevent_non_factory_instantiation_of(SchemaElements::FieldSource) - def new_relationship(field, cardinality:, related_type:, foreign_key:, direction:, references:) + def new_relationship(field, cardinality:, related_type:, foreign_key:, direction:, referenced_field_name:) @@relationship_new.call( field, cardinality: cardinality, related_type: related_type, foreign_key: foreign_key, direction: direction, - references: references + referenced_field_name: referenced_field_name ) end @@relationship_new = prevent_non_factory_instantiation_of(SchemaElements::Relationship) diff --git a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/relationship_resolver.rb b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/relationship_resolver.rb index 5eed6a845..2f890e66f 100644 --- a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/relationship_resolver.rb +++ b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/relationship_resolver.rb @@ -42,12 +42,12 @@ def resolve relation_metadata = relationship.runtime_metadata # : SchemaArtifacts::RuntimeMetadata::Relation foreign_key_parent_type = (relation_metadata.direction == :in) ? related_type : object_type - references_parent_type = (relation_metadata.direction == :in) ? object_type : related_type + referenced_parent_type = (relation_metadata.direction == :in) ? object_type : related_type if (foreign_key_error = validate_foreign_key(foreign_key_parent_type, relation_metadata)) [nil, foreign_key_error] - elsif (references_error = validate_references(references_parent_type, relation_metadata)) - [nil, references_error] + elsif (referenced_field_error = validate_referenced_field(referenced_parent_type, relation_metadata)) + [nil, referenced_field_error] else [ResolvedRelationship.new(relationship_name, relationship, related_type, relation_metadata), nil] end @@ -89,19 +89,19 @@ def validate_foreign_key(foreign_key_parent_type, relation_metadata) end end - def validate_references(references_parent_type, relation_metadata) - references_field = schema_def_state.field_path_resolver.resolve_public_path(references_parent_type, relation_metadata.references) { true } - # If it's an outbound relationship, verify that the references field exists on the related type. + def validate_referenced_field(referenced_parent_type, relation_metadata) + referenced_field = schema_def_state.field_path_resolver.resolve_public_path(referenced_parent_type, relation_metadata.referenced_field_name) { true } + # If it's an outbound relationship, verify that the referenced field exists on the related type. # Note: we don't verify this for inbound relationships, because when we define a relationship with an inbound - # foreign key, we automatically define an indexing only field for the references field (since it exists on the - # same type). We don't do that for outbound relationships, though (since the references field exists on another + # foreign key, we automatically define an indexing only field for the referenced field (since it exists on the + # same type). We don't do that for outbound relationships, though (since the referenced field exists on another # type). Allowing a relationship definition on type A to add a field to type B's schema would be weird and surprising. - if relation_metadata.direction == :out && references_field.nil? - "#{relationship_error_prefix} uses `#{references_parent_type.name}.#{relation_metadata.references}` as the `references` field, " \ - "but that field does not exist as an indexing field. To continue, define it on `#{references_parent_type.name}`, " \ + if relation_metadata.direction == :out && referenced_field.nil? + "#{relationship_error_prefix} uses `#{referenced_parent_type.name}.#{relation_metadata.referenced_field_name}` as the `references` field, " \ + "but that field does not exist as an indexing field. To continue, define it on `#{referenced_parent_type.name}`, " \ "use another field as the `references` target, or remove the `#{relationship_description}` definition." - elsif references_field && references_field.type.fully_unwrapped.name != "ID" - "#{relationship_error_prefix} uses `#{references_field.fully_qualified_path}` as the `references` field, " \ + elsif referenced_field && referenced_field.type.fully_unwrapped.name != "ID" + "#{relationship_error_prefix} uses `#{referenced_field.fully_qualified_path}` as the `references` field, " \ "but that field is not an `ID` field as expected. To continue, change its type, use another field " \ "as the `references` target, or remove the `#{relationship_description}` definition." end diff --git a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/relationship.rb b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/relationship.rb index 1350e2cc9..8d59d7bf3 100644 --- a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/relationship.rb +++ b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/relationship.rb @@ -46,14 +46,14 @@ class Relationship < DelegateClass(Field) attr_accessor :hide_relationship_runtime_metadata # @private - def initialize(field, cardinality:, related_type:, foreign_key:, direction:, references:) + def initialize(field, cardinality:, related_type:, foreign_key:, direction:, referenced_field_name:) super(field) self.hide_relationship_runtime_metadata = false @cardinality = cardinality @related_type = related_type @foreign_key = foreign_key @direction = direction - @references = references + @referenced_field_name = referenced_field_name @equivalent_field_paths_by_local_path = {} @additional_filter = {} end @@ -206,7 +206,7 @@ def runtime_metadata SchemaArtifacts::RuntimeMetadata::Relation.new( foreign_key: @foreign_key, direction: @direction, - references: @references, + referenced_field_name: @referenced_field_name, additional_filter: @additional_filter, foreign_key_nested_paths: foreign_key_nested_paths ) diff --git a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/type_with_subfields.rb b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/type_with_subfields.rb index feec84aea..c3fa7a7f2 100644 --- a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/type_with_subfields.rb +++ b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/type_with_subfields.rb @@ -407,7 +407,7 @@ def paginated_collection_field( # end def relates_to_one(field_name, type, via:, dir:, references: "id", indexing_only: false, &block) foreign_key_type = schema_def_state.type_ref(type).non_null? ? "ID!" : "ID" - relates_to(field_name, type, via: via, dir: dir, references: references, foreign_key_type: foreign_key_type, cardinality: :one, related_type: type, indexing_only: indexing_only, &block) + relates_to(field_name, type, via: via, dir: dir, referenced_field_name: references, foreign_key_type: foreign_key_type, cardinality: :one, related_type: type, indexing_only: indexing_only, &block) end # Defines a "has many" relationship between the current indexed type and another indexed type by defining a pair of fields clients @@ -479,7 +479,7 @@ def relates_to_many(field_name, type, via:, dir:, references: "id", singular: ni type_ref = schema_def_state.type_ref(type).to_final_form - relates_to(field_name, type_ref.as_connection.name, via: via, dir: dir, references: references, foreign_key_type: foreign_key_type, cardinality: :many, related_type: type, indexing_only: indexing_only) do |f| + relates_to(field_name, type_ref.as_connection.name, via: via, dir: dir, referenced_field_name: references, foreign_key_type: foreign_key_type, cardinality: :many, related_type: type, indexing_only: indexing_only) do |f| f.argument schema_def_state.schema_elements.filter, type_ref.as_filter_input.name do |a| a.documentation "Used to filter the returned `#{field_name}` based on the provided criteria." end @@ -495,7 +495,7 @@ def relates_to_many(field_name, type, via:, dir:, references: "id", singular: ni unless indexing_only aggregations_name = schema_def_state.schema_elements.normalize_case("#{singular}_aggregations") - relates_to(aggregations_name, type_ref.as_aggregation.as_connection.name, via: via, dir: dir, references: references, foreign_key_type: foreign_key_type, cardinality: :many, related_type: type) do |f| + relates_to(aggregations_name, type_ref.as_aggregation.as_connection.name, via: via, dir: dir, referenced_field_name: references, foreign_key_type: foreign_key_type, cardinality: :many, related_type: type) do |f| f.argument schema_def_state.schema_elements.filter, type_ref.as_filter_input.name do |a| a.documentation "Used to filter the `#{type}` documents that get aggregated over based on the provided criteria." end @@ -608,7 +608,7 @@ def register_field(name, field, registry, registry_type, only_option_to_fix, &to registry[name] = field end - def relates_to(field_name, type, via:, dir:, references:, foreign_key_type:, cardinality:, related_type:, indexing_only: false) + def relates_to(field_name, type, via:, dir:, referenced_field_name:, foreign_key_type:, cardinality:, related_type:, indexing_only: false) field(field_name, type, sortable: false, filterable: false, groupable: false, graphql_only: true, indexing_only: indexing_only) do |field| relationship = schema_def_state.factory.new_relationship( field, @@ -616,7 +616,7 @@ def relates_to(field_name, type, via:, dir:, references:, foreign_key_type:, car related_type: schema_def_state.type_ref(related_type).to_final_form, foreign_key: via, direction: dir, - references: references + referenced_field_name: referenced_field_name ) field.relationship = relationship @@ -625,9 +625,9 @@ def relates_to(field_name, type, via:, dir:, references:, foreign_key_type:, car yield relationship if block_given? if dir == :out - register_inferred_foreign_key_fields(from_type: [via, foreign_key_type], to_other: [references, "ID!"], related_type: relationship.related_type) + register_inferred_foreign_key_fields(from_type: [via, foreign_key_type], to_other: [referenced_field_name, "ID!"], related_type: relationship.related_type) else - register_inferred_foreign_key_fields(from_type: [references, "ID!"], to_other: [via, foreign_key_type], related_type: relationship.related_type) + register_inferred_foreign_key_fields(from_type: [referenced_field_name, "ID!"], to_other: [via, foreign_key_type], related_type: relationship.related_type) end if relationships_by_name.key?(field_name) diff --git a/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/factory.rbs b/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/factory.rbs index 89e76215e..58f737597 100644 --- a/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/factory.rbs +++ b/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/factory.rbs @@ -110,7 +110,7 @@ module ElasticGraph related_type: SchemaElements::TypeReference, foreign_key: ::String, direction: SchemaElements::foreignKeyDirection, - references: ::String + referenced_field_name: ::String ) -> SchemaElements::Relationship @@relationship_new: ::Method diff --git a/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/indexing/relationship_resolver.rbs b/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/indexing/relationship_resolver.rbs index 9032370d9..2f4c68884 100644 --- a/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/indexing/relationship_resolver.rbs +++ b/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/indexing/relationship_resolver.rbs @@ -23,7 +23,7 @@ module ElasticGraph indexableType, SchemaArtifacts::RuntimeMetadata::Relation ) -> ::String? - def validate_references: ( + def validate_referenced_field: ( indexableType, SchemaArtifacts::RuntimeMetadata::Relation ) -> ::String? diff --git a/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/schema_elements/relationship.rbs b/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/schema_elements/relationship.rbs index 0610552d0..301824047 100644 --- a/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/schema_elements/relationship.rbs +++ b/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/schema_elements/relationship.rbs @@ -14,7 +14,7 @@ module ElasticGraph @related_type: TypeReference @foreign_key: ::String @direction: foreignKeyDirection - @references: ::String + @referenced_field_name: ::String @equivalent_field_paths_by_local_path: ::Hash[::String, ::String] @additional_filter: ::Hash[::String, untyped] @@ -24,7 +24,7 @@ module ElasticGraph related_type: TypeReference, foreign_key: ::String, direction: foreignKeyDirection, - references: ::String + referenced_field_name: ::String ) -> void def additional_filter: (::Hash[::String, untyped]) -> void diff --git a/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/schema_elements/type_with_subfields.rbs b/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/schema_elements/type_with_subfields.rbs index 7bf04b9ad..8fa98c03f 100644 --- a/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/schema_elements/type_with_subfields.rbs +++ b/elasticgraph-schema_definition/sig/elastic_graph/schema_definition/schema_elements/type_with_subfields.rbs @@ -106,7 +106,7 @@ module ElasticGraph ::String, via: ::String, dir: foreignKeyDirection, - references: ::String, + referenced_field_name: ::String, foreign_key_type: ::String, cardinality: Relationship::cardinality, related_type: ::String, diff --git a/elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/runtime_metadata/object_types_by_name/relation_metadata_spec.rb b/elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/runtime_metadata/object_types_by_name/relation_metadata_spec.rb index 74ac60154..c4b6755b5 100644 --- a/elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/runtime_metadata/object_types_by_name/relation_metadata_spec.rb +++ b/elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/runtime_metadata/object_types_by_name/relation_metadata_spec.rb @@ -29,7 +29,7 @@ module SchemaDefinition relation: SchemaArtifacts::RuntimeMetadata::Relation.new( foreign_key: "parent_id", direction: :out, - references: "id", + referenced_field_name: "id", additional_filter: {}, foreign_key_nested_paths: [] ) @@ -51,7 +51,7 @@ module SchemaDefinition relation: SchemaArtifacts::RuntimeMetadata::Relation.new( foreign_key: "parent_id", direction: :in, - references: "id", + referenced_field_name: "id", additional_filter: {}, foreign_key_nested_paths: [] ) @@ -87,7 +87,7 @@ module SchemaDefinition relation: SchemaArtifacts::RuntimeMetadata::Relation.new( foreign_key: "parent_id", direction: :in, - references: "id", + referenced_field_name: "id", additional_filter: filter, foreign_key_nested_paths: [] ) @@ -124,7 +124,7 @@ module SchemaDefinition relation: SchemaArtifacts::RuntimeMetadata::Relation.new( foreign_key: "parent_id", direction: :in, - references: "id", + referenced_field_name: "id", additional_filter: {"is_enabled" => {"equal_to_any_of" => [true]}}, foreign_key_nested_paths: [] ) @@ -170,7 +170,7 @@ module SchemaDefinition relation: SchemaArtifacts::RuntimeMetadata::Relation.new( foreign_key: "parent_id", direction: :in, - references: "id", + referenced_field_name: "id", additional_filter: { "is_enabled" => {"equal_to_any_of" => [true]}, "details" => {"foo" => {"lt" => 3}, "bar" => {"gt" => 5}}, @@ -252,7 +252,7 @@ def test_foreign_key_nested_paths(type_definition_order) relation: SchemaArtifacts::RuntimeMetadata::Relation.new( foreign_key: "players.affiliations.sponsorships.sponsor_id", direction: :in, - references: "id", + referenced_field_name: "id", additional_filter: {}, foreign_key_nested_paths: ["players", "players.affiliations.sponsorships"] ) @@ -280,7 +280,7 @@ def test_foreign_key_nested_paths(type_definition_order) relation: SchemaArtifacts::RuntimeMetadata::Relation.new( foreign_key: "parent_guid", direction: :in, - references: "guid", + referenced_field_name: "guid", additional_filter: {}, foreign_key_nested_paths: [] ) diff --git a/spec_support/lib/elastic_graph/spec_support/runtime_metadata_support.rb b/spec_support/lib/elastic_graph/spec_support/runtime_metadata_support.rb index ad8df794b..3db4b69f4 100644 --- a/spec_support/lib/elastic_graph/spec_support/runtime_metadata_support.rb +++ b/spec_support/lib/elastic_graph/spec_support/runtime_metadata_support.rb @@ -152,8 +152,8 @@ def sort_field_with(field_path: "path.to.some.field", direction: :asc) ) end - def relation_with(foreign_key: "some_id", direction: :asc, references: "id", additional_filter: {}, foreign_key_nested_paths: []) - Relation.new(foreign_key: foreign_key, direction: direction, references: references, additional_filter: additional_filter, foreign_key_nested_paths: foreign_key_nested_paths) + def relation_with(foreign_key: "some_id", direction: :asc, referenced_field_name: "id", additional_filter: {}, foreign_key_nested_paths: []) + Relation.new(foreign_key: foreign_key, direction: direction, referenced_field_name: referenced_field_name, additional_filter: additional_filter, foreign_key_nested_paths: foreign_key_nested_paths) end def graphql_field_with(name_in_index: "name_index", relation: nil, computation_detail: nil, resolver: nil) From 2b22dbeacde95051aff359d284270f02e156fb3d Mon Sep 17 00:00:00 2001 From: ellisandrews-toast Date: Tue, 19 May 2026 17:31:30 -0400 Subject: [PATCH 3/6] Scope references to only embedded types --- config/schema/artifacts/data_warehouse.yaml | 4 +- config/schema/artifacts/datastore_config.yaml | 4 - config/schema/artifacts/json_schemas.yaml | 12 -- .../artifacts/json_schemas_by_version/v1.yaml | 18 -- config/schema/artifacts/runtime_metadata.yaml | 97 ----------- config/schema/artifacts/schema.graphql | 163 ------------------ .../artifacts_with_apollo/data_warehouse.yaml | 4 +- .../datastore_config.yaml | 4 - .../artifacts_with_apollo/json_schemas.yaml | 12 -- .../json_schemas_by_version/v1.yaml | 18 -- .../runtime_metadata.yaml | 97 ----------- .../artifacts_with_apollo/schema.graphql | 163 ------------------ config/schema/widgets.rb | 3 - .../spec/acceptance/hidden_types_spec.rb | 2 +- .../indexing/relationship_resolver.rb | 16 +- .../schema_elements/type_with_subfields.rb | 49 +----- .../relation_metadata_spec.rb | 29 ---- .../update_targets_spec.rb | 52 +----- .../spec_support/factories/widgets.rb | 2 - 19 files changed, 30 insertions(+), 719 deletions(-) diff --git a/config/schema/artifacts/data_warehouse.yaml b/config/schema/artifacts/data_warehouse.yaml index 5e0880b4b..6f1c02601 100644 --- a/config/schema/artifacts/data_warehouse.yaml +++ b/config/schema/artifacts/data_warehouse.yaml @@ -53,7 +53,6 @@ tables: table_schema: |- CREATE TABLE IF NOT EXISTS manufacturers ( id STRING, - guid STRING, name STRING, created_at TIMESTAMP, ceo STRUCT @@ -65,8 +64,7 @@ tables: name STRING, created_at TIMESTAMP, material STRING, - manufacturer_id STRING, - manufacturer_guid STRING + manufacturer_id STRING ) named_inventors: table_schema: |- diff --git a/config/schema/artifacts/datastore_config.yaml b/config/schema/artifacts/datastore_config.yaml index e094e8a06..7fd1aebc7 100644 --- a/config/schema/artifacts/datastore_config.yaml +++ b/config/schema/artifacts/datastore_config.yaml @@ -1677,8 +1677,6 @@ indices: properties: id: type: keyword - guid: - type: keyword name: type: keyword created_at: @@ -1724,8 +1722,6 @@ indices: type: keyword manufacturer_id: type: keyword - manufacturer_guid: - type: keyword __sources: type: keyword __versions: diff --git a/config/schema/artifacts/json_schemas.yaml b/config/schema/artifacts/json_schemas.yaml index b06d388e3..64c6f7129 100644 --- a/config/schema/artifacts/json_schemas.yaml +++ b/config/schema/artifacts/json_schemas.yaml @@ -400,10 +400,6 @@ json_schema_version: 1 allOf: - "$ref": "#/$defs/ID" - maxLength: 8191 - guid: - allOf: - - "$ref": "#/$defs/ID" - - maxLength: 8191 name: anyOf: - allOf: @@ -422,7 +418,6 @@ json_schema_version: 1 default: Manufacturer required: - id - - guid - name - created_at - ceo @@ -456,12 +451,6 @@ json_schema_version: 1 - "$ref": "#/$defs/ID" - maxLength: 8191 - type: 'null' - manufacturer_guid: - anyOf: - - allOf: - - "$ref": "#/$defs/ID" - - maxLength: 8191 - - type: 'null' __typename: type: string const: MechanicalPart @@ -472,7 +461,6 @@ json_schema_version: 1 - created_at - material - manufacturer_id - - manufacturer_guid Money: type: object properties: diff --git a/config/schema/artifacts/json_schemas_by_version/v1.yaml b/config/schema/artifacts/json_schemas_by_version/v1.yaml index bd11a86bd..ad09ed3e1 100644 --- a/config/schema/artifacts/json_schemas_by_version/v1.yaml +++ b/config/schema/artifacts/json_schemas_by_version/v1.yaml @@ -502,13 +502,6 @@ json_schema_version: 1 ElasticGraph: type: ID! nameInIndex: id - guid: - allOf: - - "$ref": "#/$defs/ID" - - maxLength: 8191 - ElasticGraph: - type: ID! - nameInIndex: guid name: anyOf: - allOf: @@ -536,7 +529,6 @@ json_schema_version: 1 default: Manufacturer required: - id - - guid - name - created_at - ceo @@ -585,15 +577,6 @@ json_schema_version: 1 ElasticGraph: type: ID nameInIndex: manufacturer_id - manufacturer_guid: - anyOf: - - allOf: - - "$ref": "#/$defs/ID" - - maxLength: 8191 - - type: 'null' - ElasticGraph: - type: ID - nameInIndex: manufacturer_guid __typename: type: string const: MechanicalPart @@ -604,7 +587,6 @@ json_schema_version: 1 - created_at - material - manufacturer_id - - manufacturer_guid Money: type: object properties: diff --git a/config/schema/artifacts/runtime_metadata.yaml b/config/schema/artifacts/runtime_metadata.yaml index 962e280c8..651824d1e 100644 --- a/config/schema/artifacts/runtime_metadata.yaml +++ b/config/schema/artifacts/runtime_metadata.yaml @@ -325,14 +325,6 @@ enum_types_by_name: sort_field: direction: desc field_path: created_at - guid_ASC: - sort_field: - direction: asc - field_path: guid - guid_DESC: - sort_field: - direction: desc - field_path: guid id_ASC: sort_field: direction: asc @@ -523,14 +515,6 @@ enum_types_by_name: sort_field: direction: desc field_path: created_on - guid_ASC: - sort_field: - direction: asc - field_path: guid - guid_DESC: - sort_field: - direction: desc - field_path: guid id_ASC: sort_field: direction: asc @@ -1938,8 +1922,6 @@ index_definitions_by_name: source: __self created_at: source: __self - guid: - source: __self id: source: __self name: @@ -1956,8 +1938,6 @@ index_definitions_by_name: source: __self id: source: __self - manufacturer_guid: - source: __self manufacturer_id: source: __self material: @@ -4373,9 +4353,6 @@ object_types_by_name: created_at: resolver: name: get_record_field_value - guid: - resolver: - name: get_record_field_value id: resolver: name: get_record_field_value @@ -4393,20 +4370,6 @@ object_types_by_name: referenced_field_name: id resolver: name: nested_relationships - mechanical_part_aggregations: - relation: - direction: in - foreign_key: manufacturer_guid - referenced_field_name: guid - resolver: - name: nested_relationships - mechanical_parts: - relation: - direction: in - foreign_key: manufacturer_guid - referenced_field_name: guid - resolver: - name: nested_relationships name: resolver: name: get_record_field_value @@ -4418,8 +4381,6 @@ object_types_by_name: cardinality: one created_at: cardinality: one - guid: - cardinality: one name: cardinality: one id_source: id @@ -4446,9 +4407,6 @@ object_types_by_name: created_at: resolver: name: object_with_lookahead - guid: - resolver: - name: object_with_lookahead id: resolver: name: object_with_lookahead @@ -4527,9 +4485,6 @@ object_types_by_name: created_at: resolver: name: object_with_lookahead - guid: - resolver: - name: object_with_lookahead name: resolver: name: object_with_lookahead @@ -4538,9 +4493,6 @@ object_types_by_name: ceo: resolver: name: get_record_field_value - guid: - resolver: - name: get_record_field_value id: resolver: name: get_record_field_value @@ -4576,13 +4528,6 @@ object_types_by_name: referenced_field_name: id resolver: name: nested_relationships - manufacturer_by_guid: - relation: - direction: out - foreign_key: manufacturer_guid - referenced_field_name: guid - resolver: - name: nested_relationships material: resolver: name: get_record_field_value @@ -4595,8 +4540,6 @@ object_types_by_name: - data_params: created_at: cardinality: one - manufacturer_guid: - cardinality: one manufacturer_id: cardinality: one material: @@ -4841,9 +4784,6 @@ object_types_by_name: fees: resolver: name: get_record_field_value - guid: - resolver: - name: get_record_field_value id: resolver: name: get_record_field_value @@ -4883,30 +4823,9 @@ object_types_by_name: referenced_field_name: id resolver: name: nested_relationships - manufacturer_by_guid: - relation: - direction: out - foreign_key: manufacturer_guid - referenced_field_name: guid - resolver: - name: nested_relationships material: resolver: name: get_record_field_value - mechanical_part_aggregations: - relation: - direction: in - foreign_key: manufacturer_guid - referenced_field_name: guid - resolver: - name: nested_relationships - mechanical_parts: - relation: - direction: in - foreign_key: manufacturer_guid - referenced_field_name: guid - resolver: - name: nested_relationships metadata: resolver: name: get_record_field_value @@ -5058,9 +4977,6 @@ object_types_by_name: fees: resolver: name: object_with_lookahead - guid: - resolver: - name: object_with_lookahead id: resolver: name: object_with_lookahead @@ -5272,9 +5188,6 @@ object_types_by_name: fees: resolver: name: object_with_lookahead - guid: - resolver: - name: object_with_lookahead internal_details: resolver: name: object_with_lookahead @@ -5383,9 +5296,6 @@ object_types_by_name: fees: resolver: name: get_record_field_value - guid: - resolver: - name: get_record_field_value id: resolver: name: get_record_field_value @@ -5669,13 +5579,6 @@ object_types_by_name: referenced_field_name: id resolver: name: nested_relationships - manufacturer_by_guid: - relation: - direction: out - foreign_key: manufacturer_guid - referenced_field_name: guid - resolver: - name: nested_relationships material: resolver: name: get_record_field_value diff --git a/config/schema/artifacts/schema.graphql b/config/schema/artifacts/schema.graphql index d0c2e7b0f..3c6220fba 100644 --- a/config/schema/artifacts/schema.graphql +++ b/config/schema/artifacts/schema.graphql @@ -4764,7 +4764,6 @@ type Manufacturer implements NamedEntity { address: Address ceo: Person created_at: DateTime! - guid: ID! id: ID! """ @@ -4863,103 +4862,6 @@ type Manufacturer implements NamedEntity { """ order_by: [PartSortOrderInput!] ): PartConnection - - """ - Aggregations over the `mechanical_parts` data. - """ - mechanical_part_aggregations( - """ - Used to forward-paginate through the `mechanical_part_aggregations`. When provided, the next page after the - provided cursor will be returned. - - See the [Relay GraphQL Cursor Connections - Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. - """ - after: Cursor - - """ - Used to backward-paginate through the `mechanical_part_aggregations`. When provided, the previous page before the - provided cursor will be returned. - - See the [Relay GraphQL Cursor Connections - Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. - """ - before: Cursor - - """ - Used to filter the `MechanicalPart` documents that get aggregated over based on the provided criteria. - """ - filter: MechanicalPartFilterInput - - """ - Used in conjunction with the `after` argument to forward-paginate through the `mechanical_part_aggregations`. - When provided, limits the number of returned results to the first `n` after the provided - `after` cursor (or from the start of the `mechanical_part_aggregations`, if no `after` cursor is provided). - - See the [Relay GraphQL Cursor Connections - Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. - """ - first: Int - - """ - Used in conjunction with the `before` argument to backward-paginate through the `mechanical_part_aggregations`. - When provided, limits the number of returned results to the last `n` before the provided - `before` cursor (or from the end of the `mechanical_part_aggregations`, if no `before` cursor is provided). - - See the [Relay GraphQL Cursor Connections - Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. - """ - last: Int - ): MechanicalPartAggregationConnection - mechanical_parts( - """ - Used to forward-paginate through the `mechanical_parts`. When provided, the next page after the - provided cursor will be returned. - - See the [Relay GraphQL Cursor Connections - Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. - """ - after: Cursor - - """ - Used to backward-paginate through the `mechanical_parts`. When provided, the previous page before the - provided cursor will be returned. - - See the [Relay GraphQL Cursor Connections - Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. - """ - before: Cursor - - """ - Used to filter the returned `mechanical_parts` based on the provided criteria. - """ - filter: MechanicalPartFilterInput - - """ - Used in conjunction with the `after` argument to forward-paginate through the `mechanical_parts`. - When provided, limits the number of returned results to the first `n` after the provided - `after` cursor (or from the start of the `mechanical_parts`, if no `after` cursor is provided). - - See the [Relay GraphQL Cursor Connections - Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. - """ - first: Int - - """ - Used in conjunction with the `before` argument to backward-paginate through the `mechanical_parts`. - When provided, limits the number of returned results to the last `n` before the provided - `before` cursor (or from the end of the `mechanical_parts`, if no `before` cursor is provided). - - See the [Relay GraphQL Cursor Connections - Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. - """ - last: Int - - """ - Used to specify how the returned `mechanical_parts` should be sorted. - """ - order_by: [MechanicalPartSortOrderInput!] - ): MechanicalPartConnection name: String } @@ -4977,11 +4879,6 @@ type ManufacturerAggregatedValues { """ created_at: DateTimeAggregatedValues - """ - Computed aggregate values for the `guid` field. - """ - guid: NonNumericAggregatedValues - """ Computed aggregate values for the `id` field. """ @@ -5155,13 +5052,6 @@ input ManufacturerFilterInput { """ created_at: DateTimeFilterInput - """ - Used to filter on the `guid` field. - - When `null` or an empty object is passed, matches all documents. - """ - guid: IDFilterInput - """ Used to filter on the `id` field. @@ -5199,11 +5089,6 @@ type ManufacturerGroupedBy { """ created_at: DateTimeGroupedBy - """ - The `guid` field value for this group. - """ - guid: ID - """ The `name` field value for this group. """ @@ -5219,11 +5104,6 @@ type ManufacturerHighlights { """ ceo: PersonHighlights - """ - Search highlights for the `guid`, providing snippets of the matching text. - """ - guid: [String!]! - """ Search highlights for the `id`, providing snippets of the matching text. """ @@ -5279,16 +5159,6 @@ enum ManufacturerSortOrderInput { """ created_at_DESC - """ - Sorts ascending by the `guid` field. - """ - guid_ASC - - """ - Sorts descending by the `guid` field. - """ - guid_DESC - """ Sorts ascending by the `id` field. """ @@ -5551,7 +5421,6 @@ type MechanicalPart implements NamedEntity { created_at: DateTime! id: ID! manufacturer: Manufacturer - manufacturer_by_guid: Manufacturer material: Material name: String } @@ -6139,11 +6008,6 @@ type NamedEntityAggregatedValues { """ fees: MoneyAggregatedValues - """ - Computed aggregate values for the `guid` field. - """ - guid: NonNumericAggregatedValues - """ Computed aggregate values for the `id` field. """ @@ -6548,13 +6412,6 @@ input NamedEntityFilterInput { """ fees: MoneyFieldsListFilterInput - """ - Used to filter on the `guid` field. - - When `null` or an empty object is passed, matches all documents. - """ - guid: IDFilterInput - """ Used to filter on the `id` field. @@ -6841,11 +6698,6 @@ type NamedEntityGroupedBy { """ fees: MoneyGroupedBy - """ - The `guid` field value for this group. - """ - guid: ID - """ The `internal_details` field value for this group. """ @@ -7035,11 +6887,6 @@ type NamedEntityHighlights { """ fees: MoneyHighlights - """ - Search highlights for the `guid`, providing snippets of the matching text. - """ - guid: [String!]! - """ Search highlights for the `id`, providing snippets of the matching text. """ @@ -7305,16 +7152,6 @@ enum NamedEntitySortOrderInput { """ created_on_DESC - """ - Sorts ascending by the `guid` field. - """ - guid_ASC - - """ - Sorts descending by the `guid` field. - """ - guid_DESC - """ Sorts ascending by the `id` field. """ diff --git a/config/schema/artifacts_with_apollo/data_warehouse.yaml b/config/schema/artifacts_with_apollo/data_warehouse.yaml index 5e0880b4b..6f1c02601 100644 --- a/config/schema/artifacts_with_apollo/data_warehouse.yaml +++ b/config/schema/artifacts_with_apollo/data_warehouse.yaml @@ -53,7 +53,6 @@ tables: table_schema: |- CREATE TABLE IF NOT EXISTS manufacturers ( id STRING, - guid STRING, name STRING, created_at TIMESTAMP, ceo STRUCT @@ -65,8 +64,7 @@ tables: name STRING, created_at TIMESTAMP, material STRING, - manufacturer_id STRING, - manufacturer_guid STRING + manufacturer_id STRING ) named_inventors: table_schema: |- diff --git a/config/schema/artifacts_with_apollo/datastore_config.yaml b/config/schema/artifacts_with_apollo/datastore_config.yaml index e094e8a06..7fd1aebc7 100644 --- a/config/schema/artifacts_with_apollo/datastore_config.yaml +++ b/config/schema/artifacts_with_apollo/datastore_config.yaml @@ -1677,8 +1677,6 @@ indices: properties: id: type: keyword - guid: - type: keyword name: type: keyword created_at: @@ -1724,8 +1722,6 @@ indices: type: keyword manufacturer_id: type: keyword - manufacturer_guid: - type: keyword __sources: type: keyword __versions: diff --git a/config/schema/artifacts_with_apollo/json_schemas.yaml b/config/schema/artifacts_with_apollo/json_schemas.yaml index b06d388e3..64c6f7129 100644 --- a/config/schema/artifacts_with_apollo/json_schemas.yaml +++ b/config/schema/artifacts_with_apollo/json_schemas.yaml @@ -400,10 +400,6 @@ json_schema_version: 1 allOf: - "$ref": "#/$defs/ID" - maxLength: 8191 - guid: - allOf: - - "$ref": "#/$defs/ID" - - maxLength: 8191 name: anyOf: - allOf: @@ -422,7 +418,6 @@ json_schema_version: 1 default: Manufacturer required: - id - - guid - name - created_at - ceo @@ -456,12 +451,6 @@ json_schema_version: 1 - "$ref": "#/$defs/ID" - maxLength: 8191 - type: 'null' - manufacturer_guid: - anyOf: - - allOf: - - "$ref": "#/$defs/ID" - - maxLength: 8191 - - type: 'null' __typename: type: string const: MechanicalPart @@ -472,7 +461,6 @@ json_schema_version: 1 - created_at - material - manufacturer_id - - manufacturer_guid Money: type: object properties: diff --git a/config/schema/artifacts_with_apollo/json_schemas_by_version/v1.yaml b/config/schema/artifacts_with_apollo/json_schemas_by_version/v1.yaml index bd11a86bd..ad09ed3e1 100644 --- a/config/schema/artifacts_with_apollo/json_schemas_by_version/v1.yaml +++ b/config/schema/artifacts_with_apollo/json_schemas_by_version/v1.yaml @@ -502,13 +502,6 @@ json_schema_version: 1 ElasticGraph: type: ID! nameInIndex: id - guid: - allOf: - - "$ref": "#/$defs/ID" - - maxLength: 8191 - ElasticGraph: - type: ID! - nameInIndex: guid name: anyOf: - allOf: @@ -536,7 +529,6 @@ json_schema_version: 1 default: Manufacturer required: - id - - guid - name - created_at - ceo @@ -585,15 +577,6 @@ json_schema_version: 1 ElasticGraph: type: ID nameInIndex: manufacturer_id - manufacturer_guid: - anyOf: - - allOf: - - "$ref": "#/$defs/ID" - - maxLength: 8191 - - type: 'null' - ElasticGraph: - type: ID - nameInIndex: manufacturer_guid __typename: type: string const: MechanicalPart @@ -604,7 +587,6 @@ json_schema_version: 1 - created_at - material - manufacturer_id - - manufacturer_guid Money: type: object properties: diff --git a/config/schema/artifacts_with_apollo/runtime_metadata.yaml b/config/schema/artifacts_with_apollo/runtime_metadata.yaml index 7c63c72b7..69cfafb47 100644 --- a/config/schema/artifacts_with_apollo/runtime_metadata.yaml +++ b/config/schema/artifacts_with_apollo/runtime_metadata.yaml @@ -325,14 +325,6 @@ enum_types_by_name: sort_field: direction: desc field_path: created_at - guid_ASC: - sort_field: - direction: asc - field_path: guid - guid_DESC: - sort_field: - direction: desc - field_path: guid id_ASC: sort_field: direction: asc @@ -523,14 +515,6 @@ enum_types_by_name: sort_field: direction: desc field_path: created_on - guid_ASC: - sort_field: - direction: asc - field_path: guid - guid_DESC: - sort_field: - direction: desc - field_path: guid id_ASC: sort_field: direction: asc @@ -1967,8 +1951,6 @@ index_definitions_by_name: source: __self created_at: source: __self - guid: - source: __self id: source: __self name: @@ -1985,8 +1967,6 @@ index_definitions_by_name: source: __self id: source: __self - manufacturer_guid: - source: __self manufacturer_id: source: __self material: @@ -4477,9 +4457,6 @@ object_types_by_name: created_at: resolver: name: get_record_field_value - guid: - resolver: - name: get_record_field_value id: resolver: name: get_record_field_value @@ -4497,20 +4474,6 @@ object_types_by_name: referenced_field_name: id resolver: name: nested_relationships - mechanical_part_aggregations: - relation: - direction: in - foreign_key: manufacturer_guid - referenced_field_name: guid - resolver: - name: nested_relationships - mechanical_parts: - relation: - direction: in - foreign_key: manufacturer_guid - referenced_field_name: guid - resolver: - name: nested_relationships name: resolver: name: get_record_field_value @@ -4522,8 +4485,6 @@ object_types_by_name: cardinality: one created_at: cardinality: one - guid: - cardinality: one name: cardinality: one id_source: id @@ -4550,9 +4511,6 @@ object_types_by_name: created_at: resolver: name: object_with_lookahead - guid: - resolver: - name: object_with_lookahead id: resolver: name: object_with_lookahead @@ -4631,9 +4589,6 @@ object_types_by_name: created_at: resolver: name: object_with_lookahead - guid: - resolver: - name: object_with_lookahead name: resolver: name: object_with_lookahead @@ -4642,9 +4597,6 @@ object_types_by_name: ceo: resolver: name: get_record_field_value - guid: - resolver: - name: get_record_field_value id: resolver: name: get_record_field_value @@ -4680,13 +4632,6 @@ object_types_by_name: referenced_field_name: id resolver: name: nested_relationships - manufacturer_by_guid: - relation: - direction: out - foreign_key: manufacturer_guid - referenced_field_name: guid - resolver: - name: nested_relationships material: resolver: name: get_record_field_value @@ -4699,8 +4644,6 @@ object_types_by_name: - data_params: created_at: cardinality: one - manufacturer_guid: - cardinality: one manufacturer_id: cardinality: one material: @@ -4945,9 +4888,6 @@ object_types_by_name: fees: resolver: name: get_record_field_value - guid: - resolver: - name: get_record_field_value id: resolver: name: get_record_field_value @@ -4987,30 +4927,9 @@ object_types_by_name: referenced_field_name: id resolver: name: nested_relationships - manufacturer_by_guid: - relation: - direction: out - foreign_key: manufacturer_guid - referenced_field_name: guid - resolver: - name: nested_relationships material: resolver: name: get_record_field_value - mechanical_part_aggregations: - relation: - direction: in - foreign_key: manufacturer_guid - referenced_field_name: guid - resolver: - name: nested_relationships - mechanical_parts: - relation: - direction: in - foreign_key: manufacturer_guid - referenced_field_name: guid - resolver: - name: nested_relationships metadata: resolver: name: get_record_field_value @@ -5183,9 +5102,6 @@ object_types_by_name: fees: resolver: name: object_with_lookahead - guid: - resolver: - name: object_with_lookahead id: resolver: name: object_with_lookahead @@ -5397,9 +5313,6 @@ object_types_by_name: fees: resolver: name: object_with_lookahead - guid: - resolver: - name: object_with_lookahead internal_details: resolver: name: object_with_lookahead @@ -5508,9 +5421,6 @@ object_types_by_name: fees: resolver: name: get_record_field_value - guid: - resolver: - name: get_record_field_value id: resolver: name: get_record_field_value @@ -5794,13 +5704,6 @@ object_types_by_name: referenced_field_name: id resolver: name: nested_relationships - manufacturer_by_guid: - relation: - direction: out - foreign_key: manufacturer_guid - referenced_field_name: guid - resolver: - name: nested_relationships material: resolver: name: get_record_field_value diff --git a/config/schema/artifacts_with_apollo/schema.graphql b/config/schema/artifacts_with_apollo/schema.graphql index 674a170f9..7f97bcee0 100644 --- a/config/schema/artifacts_with_apollo/schema.graphql +++ b/config/schema/artifacts_with_apollo/schema.graphql @@ -5046,7 +5046,6 @@ type Manufacturer implements NamedEntity @key(fields: "id") { address: Address ceo: Person created_at: DateTime! - guid: ID! id: ID! """ @@ -5145,103 +5144,6 @@ type Manufacturer implements NamedEntity @key(fields: "id") { """ order_by: [PartSortOrderInput!] ): PartConnection - - """ - Aggregations over the `mechanical_parts` data. - """ - mechanical_part_aggregations( - """ - Used to forward-paginate through the `mechanical_part_aggregations`. When provided, the next page after the - provided cursor will be returned. - - See the [Relay GraphQL Cursor Connections - Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. - """ - after: Cursor - - """ - Used to backward-paginate through the `mechanical_part_aggregations`. When provided, the previous page before the - provided cursor will be returned. - - See the [Relay GraphQL Cursor Connections - Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. - """ - before: Cursor - - """ - Used to filter the `MechanicalPart` documents that get aggregated over based on the provided criteria. - """ - filter: MechanicalPartFilterInput - - """ - Used in conjunction with the `after` argument to forward-paginate through the `mechanical_part_aggregations`. - When provided, limits the number of returned results to the first `n` after the provided - `after` cursor (or from the start of the `mechanical_part_aggregations`, if no `after` cursor is provided). - - See the [Relay GraphQL Cursor Connections - Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. - """ - first: Int - - """ - Used in conjunction with the `before` argument to backward-paginate through the `mechanical_part_aggregations`. - When provided, limits the number of returned results to the last `n` before the provided - `before` cursor (or from the end of the `mechanical_part_aggregations`, if no `before` cursor is provided). - - See the [Relay GraphQL Cursor Connections - Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. - """ - last: Int - ): MechanicalPartAggregationConnection - mechanical_parts( - """ - Used to forward-paginate through the `mechanical_parts`. When provided, the next page after the - provided cursor will be returned. - - See the [Relay GraphQL Cursor Connections - Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. - """ - after: Cursor - - """ - Used to backward-paginate through the `mechanical_parts`. When provided, the previous page before the - provided cursor will be returned. - - See the [Relay GraphQL Cursor Connections - Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. - """ - before: Cursor - - """ - Used to filter the returned `mechanical_parts` based on the provided criteria. - """ - filter: MechanicalPartFilterInput - - """ - Used in conjunction with the `after` argument to forward-paginate through the `mechanical_parts`. - When provided, limits the number of returned results to the first `n` after the provided - `after` cursor (or from the start of the `mechanical_parts`, if no `after` cursor is provided). - - See the [Relay GraphQL Cursor Connections - Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. - """ - first: Int - - """ - Used in conjunction with the `before` argument to backward-paginate through the `mechanical_parts`. - When provided, limits the number of returned results to the last `n` before the provided - `before` cursor (or from the end of the `mechanical_parts`, if no `before` cursor is provided). - - See the [Relay GraphQL Cursor Connections - Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. - """ - last: Int - - """ - Used to specify how the returned `mechanical_parts` should be sorted. - """ - order_by: [MechanicalPartSortOrderInput!] - ): MechanicalPartConnection name: String } @@ -5259,11 +5161,6 @@ type ManufacturerAggregatedValues { """ created_at: DateTimeAggregatedValues - """ - Computed aggregate values for the `guid` field. - """ - guid: NonNumericAggregatedValues - """ Computed aggregate values for the `id` field. """ @@ -5437,13 +5334,6 @@ input ManufacturerFilterInput { """ created_at: DateTimeFilterInput - """ - Used to filter on the `guid` field. - - When `null` or an empty object is passed, matches all documents. - """ - guid: IDFilterInput - """ Used to filter on the `id` field. @@ -5481,11 +5371,6 @@ type ManufacturerGroupedBy { """ created_at: DateTimeGroupedBy - """ - The `guid` field value for this group. - """ - guid: ID - """ The `name` field value for this group. """ @@ -5501,11 +5386,6 @@ type ManufacturerHighlights { """ ceo: PersonHighlights - """ - Search highlights for the `guid`, providing snippets of the matching text. - """ - guid: [String!]! - """ Search highlights for the `id`, providing snippets of the matching text. """ @@ -5561,16 +5441,6 @@ enum ManufacturerSortOrderInput { """ created_at_DESC - """ - Sorts ascending by the `guid` field. - """ - guid_ASC - - """ - Sorts descending by the `guid` field. - """ - guid_DESC - """ Sorts ascending by the `id` field. """ @@ -5833,7 +5703,6 @@ type MechanicalPart implements NamedEntity @key(fields: "id") { created_at: DateTime! id: ID! manufacturer: Manufacturer - manufacturer_by_guid: Manufacturer material: Material name: String } @@ -6421,11 +6290,6 @@ type NamedEntityAggregatedValues { """ fees: MoneyAggregatedValues - """ - Computed aggregate values for the `guid` field. - """ - guid: NonNumericAggregatedValues - """ Computed aggregate values for the `id` field. """ @@ -6830,13 +6694,6 @@ input NamedEntityFilterInput { """ fees: MoneyFieldsListFilterInput - """ - Used to filter on the `guid` field. - - When `null` or an empty object is passed, matches all documents. - """ - guid: IDFilterInput - """ Used to filter on the `id` field. @@ -7123,11 +6980,6 @@ type NamedEntityGroupedBy { """ fees: MoneyGroupedBy - """ - The `guid` field value for this group. - """ - guid: ID - """ The `internal_details` field value for this group. """ @@ -7317,11 +7169,6 @@ type NamedEntityHighlights { """ fees: MoneyHighlights - """ - Search highlights for the `guid`, providing snippets of the matching text. - """ - guid: [String!]! - """ Search highlights for the `id`, providing snippets of the matching text. """ @@ -7587,16 +7434,6 @@ enum NamedEntitySortOrderInput { """ created_on_DESC - """ - Sorts ascending by the `guid` field. - """ - guid_ASC - - """ - Sorts descending by the `guid` field. - """ - guid_DESC - """ Sorts ascending by the `id` field. """ diff --git a/config/schema/widgets.rb b/config/schema/widgets.rb index 41289d028..490f85408 100644 --- a/config/schema/widgets.rb +++ b/config/schema/widgets.rb @@ -320,7 +320,6 @@ t.field "material", "Material" t.relates_to_many "components", "Component", via: "part_ids", dir: :in, singular: "component" t.relates_to_one "manufacturer", "Manufacturer", via: "manufacturer_id", dir: :out - t.relates_to_one "manufacturer_by_guid", "Manufacturer", via: "manufacturer_guid", references: "guid", dir: :out t.index "mechanical_parts" do |i| i.default_sort "created_at", :desc @@ -415,12 +414,10 @@ t.root_query_fields plural: "manufacturers" t.implements "NamedEntity" t.field "id", "ID!" - t.field "guid", "ID!" t.field "name", "String" t.field "created_at", "DateTime!" t.field "ceo", "Person" t.relates_to_many "manufactured_parts", "Part", via: "manufacturer_id", dir: :in, singular: "manufactured_part" - t.relates_to_many "mechanical_parts", "MechanicalPart", via: "manufacturer_guid", references: "guid", dir: :in, singular: "mechanical_part" t.relates_to_one "address", "Address", via: "manufacturer_id", dir: :in t.index "manufacturers" do |i| diff --git a/elasticgraph-graphql/spec/acceptance/hidden_types_spec.rb b/elasticgraph-graphql/spec/acceptance/hidden_types_spec.rb index f7d165f3b..e25c611df 100644 --- a/elasticgraph-graphql/spec/acceptance/hidden_types_spec.rb +++ b/elasticgraph-graphql/spec/acceptance/hidden_types_spec.rb @@ -53,7 +53,7 @@ module ElasticGraph expect(hidden_fields).to eq( "Query" => [case_correctly("address_aggregations"), "addresses", case_correctly("mechanical_part_aggregations"), case_correctly("mechanical_parts")], - "Manufacturer" => ["address", case_correctly("mechanical_part_aggregations"), case_correctly("mechanical_parts")] + "Manufacturer" => ["address"] ) # Our mechanism for determining which types to hide on the basis of inaccessible indexes uses the type name. diff --git a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/relationship_resolver.rb b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/relationship_resolver.rb index 2f890e66f..6b4a18ebd 100644 --- a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/relationship_resolver.rb +++ b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/indexing/relationship_resolver.rb @@ -41,7 +41,6 @@ def resolve else relation_metadata = relationship.runtime_metadata # : SchemaArtifacts::RuntimeMetadata::Relation foreign_key_parent_type = (relation_metadata.direction == :in) ? related_type : object_type - referenced_parent_type = (relation_metadata.direction == :in) ? object_type : related_type if (foreign_key_error = validate_foreign_key(foreign_key_parent_type, relation_metadata)) @@ -100,10 +99,17 @@ def validate_referenced_field(referenced_parent_type, relation_metadata) "#{relationship_error_prefix} uses `#{referenced_parent_type.name}.#{relation_metadata.referenced_field_name}` as the `references` field, " \ "but that field does not exist as an indexing field. To continue, define it on `#{referenced_parent_type.name}`, " \ "use another field as the `references` target, or remove the `#{relationship_description}` definition." - elsif referenced_field && referenced_field.type.fully_unwrapped.name != "ID" - "#{relationship_error_prefix} uses `#{referenced_field.fully_qualified_path}` as the `references` field, " \ - "but that field is not an `ID` field as expected. To continue, change its type, use another field " \ - "as the `references` target, or remove the `#{relationship_description}` definition." + # For indexed types (root document types), the referenced field must be "id" (the document ID field). + # This is because the indexer uses foreign key values directly as document IDs for updates + # (see Mixins::HasIndices where normal indexing update targets are created with `id_source: "id"`). + # Embedded types don't have this constraint since they don't have document IDs - the `references` + # parameter is only meaningful for matching nested objects within embedded types. + elsif referenced_parent_type.root_document_type? && relation_metadata.referenced_field_name != "id" + "#{relationship_error_prefix} uses `references: \"#{relation_metadata.referenced_field_name}\"` " \ + "on indexed type `#{referenced_parent_type.name}`, but the `references` parameter can only be customized " \ + "for relationships to embedded types. For indexed types, `references` must be \"id\" because ElasticGraph " \ + "uses foreign key values directly as document `_id` values when updating related documents, and document IDs " \ + "are always sourced from the \"id\" field. To fix this, remove the `references` parameter (it defaults to \"id\")." end end diff --git a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/type_with_subfields.rb b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/type_with_subfields.rb index c3fa7a7f2..786444398 100644 --- a/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/type_with_subfields.rb +++ b/elasticgraph-schema_definition/lib/elastic_graph/schema_definition/schema_elements/type_with_subfields.rb @@ -361,8 +361,10 @@ def paginated_collection_field( # @param dir [:in, :out] direction of the foreign key. Use `:in` for an inbound foreign key that resides on the related type and # references the identifier of this type. Use `:out` for an outbound foreign key that resides on this type and references the # identifier of the related type. - # @param references [String] the field that the foreign key points to. Defaults to `"id"`. Use this when the target of the - # foreign key uses a different identifier field (e.g. `"guid"`). + # @param references [String] the field that the foreign key points to. Defaults to `"id"`. For indexed types (root document types), + # this must always be `"id"` because document IDs are always sourced from the `id` field. This parameter can only be customized + # when the referenced type is an embedded type (a type without an index), allowing you to match on a different field within + # nested objects (e.g. `"guid"`). # @param indexing_only [Boolean] when true, the relationship is used only for indexing purposes (e.g. `sourced_from`) and will not # generate a GraphQL field. # @yield [Relationship] the generated relationship fields, for further customization @@ -387,24 +389,6 @@ def paginated_collection_field( # t.index "players" # end # end - # - # @example Use `references` when the foreign key points to a field other than `id` - # ElasticGraph.define_schema do |schema| - # schema.object_type "Team" do |t| - # t.field "id", "ID" - # t.field "guid", "ID" - # t.field "name", "String" - # t.field "homeCity", "String" - # t.index "teams" - # end - # - # schema.object_type "Player" do |t| - # t.field "id", "ID" - # t.field "name", "String" - # t.relates_to_one "team", "Team", via: "teamGuid", references: "guid", dir: :out - # t.index "players" - # end - # end def relates_to_one(field_name, type, via:, dir:, references: "id", indexing_only: false, &block) foreign_key_type = schema_def_state.type_ref(type).non_null? ? "ID!" : "ID" relates_to(field_name, type, via: via, dir: dir, referenced_field_name: references, foreign_key_type: foreign_key_type, cardinality: :one, related_type: type, indexing_only: indexing_only, &block) @@ -421,8 +405,10 @@ def relates_to_one(field_name, type, via:, dir:, references: "id", indexing_only # @param dir [:in, :out] direction of the foreign key. Use `:in` for an inbound foreign key that resides on the related type and # references the identifier of this type. Use `:out` for an outbound foreign key that resides on this type and references the # identifier of the related type. - # @param references [String] the field that the foreign key points to. Defaults to `"id"`. Use this when the target of the - # foreign key uses a different identifier field (e.g. `"guid"`). + # @param references [String] the field that the foreign key points to. Defaults to `"id"`. For indexed types (root document types), + # this must always be `"id"` because document IDs are always sourced from the `id` field. This parameter can only be customized + # when the referenced type is an embedded type (a type without an index), allowing you to match on a different field within + # nested objects (e.g. `"guid"`). # @param singular [String] singular form of the `field_name`; will be used (along with an `Aggregations` suffix) for the name of # the generated aggregations field. Not required when `indexing_only: true`. # @param indexing_only [Boolean] when true, the relationship is used only for indexing purposes (e.g. `sourced_from`) and will not @@ -451,25 +437,6 @@ def relates_to_one(field_name, type, via:, dir:, references: "id", indexing_only # t.index "players" # end # end - # - # @example Use `references` when the foreign key points to a field other than `id` - # ElasticGraph.define_schema do |schema| - # schema.object_type "Team" do |t| - # t.field "id", "ID" - # t.field "guid", "ID" - # t.field "name", "String" - # t.field "homeCity", "String" - # t.relates_to_many "players", "Player", via: "teamGuid", references: "guid", dir: :in, singular: "player" - # t.index "teams" - # end - # - # schema.object_type "Player" do |t| - # t.field "id", "ID" - # t.field "name", "String" - # t.field "teamGuid", "ID" - # t.index "players" - # end - # end def relates_to_many(field_name, type, via:, dir:, references: "id", singular: nil, indexing_only: false) foreign_key_type = (dir == :out) ? "[ID!]!" : "ID" diff --git a/elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/runtime_metadata/object_types_by_name/relation_metadata_spec.rb b/elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/runtime_metadata/object_types_by_name/relation_metadata_spec.rb index c4b6755b5..d824162d1 100644 --- a/elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/runtime_metadata/object_types_by_name/relation_metadata_spec.rb +++ b/elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/runtime_metadata/object_types_by_name/relation_metadata_spec.rb @@ -264,35 +264,6 @@ def test_foreign_key_nested_paths(type_definition_order) end end - describe "references parameter" do - it "includes a custom references value in relation metadata" do - metadata = object_type_metadata_for "Widget" do |s| - s.object_type "Widget" do |t| - t.field "id", "ID" - t.field "guid", "ID" - t.relates_to_many "children", "Widget", via: "parent_guid", dir: :in, references: "guid", singular: "child" - t.index "widgets" - end - end - - expected_relation_field = graphql_field_with( - resolver: configured_graphql_resolver(:nested_relationships), - relation: SchemaArtifacts::RuntimeMetadata::Relation.new( - foreign_key: "parent_guid", - direction: :in, - referenced_field_name: "guid", - additional_filter: {}, - foreign_key_nested_paths: [] - ) - ) - - expect(metadata.graphql_fields_by_name.slice("children", "child_aggregations")).to eq({ - "children" => expected_relation_field.with(name_in_index: "children"), - "child_aggregations" => expected_relation_field.with(name_in_index: "child_aggregations") - }) - end - end - describe "indexing_only relationships" do it "excludes `indexing_only: true` relationships from graphql_fields_by_name in runtime metadata" do metadata = object_type_metadata_for "Widget" do |s| diff --git a/elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/runtime_metadata/object_types_by_name/update_targets_spec.rb b/elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/runtime_metadata/object_types_by_name/update_targets_spec.rb index fd14b9fb4..a65eb92ad 100644 --- a/elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/runtime_metadata/object_types_by_name/update_targets_spec.rb +++ b/elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/runtime_metadata/object_types_by_name/update_targets_spec.rb @@ -861,36 +861,6 @@ def expect_widget_update_target_with( }.not_to raise_error end - it "raises an error if an inbound references field is not an `ID`, regardless of whether there are any `sourced_from` fields or not" do - expect { - update_targets_for("Widget") do |t| - t.field "numeric_id", "Int" - t.relates_to_one "workspace", "WidgetWorkspace", via: "widget_ids", dir: :in, references: "numeric_id" - - t.field "workspace_name", "String" do |f| - f.sourced_from "workspace", "name" - end - - t.field "workspace_created_at", "DateTime" do |f| - f.sourced_from "workspace", "created_at" - end - end - }.to raise_error_about_workspace_relationship( - "uses `Widget.numeric_id` as the `references` field, but that field is not an `ID` field as expected." - ) - - expect { - update_targets_for("Widget") do |t| - t.field "numeric_id", "Int" - t.relates_to_one "workspace", "WidgetWorkspace", via: "widget_ids", dir: :in, references: "numeric_id" - expect(t.fields_with_sources).to be_empty - end - }.to raise_error_about_workspace_relationship( - "uses `Widget.numeric_id` as the `references` field, but that field is not an `ID` field as expected.", - sourced_fields: false - ) - end - it "raises an error if an outbound references field does not exist on the related type" do expect { update_targets_for("Widget", on_widget_workspace_type: ->(t) { @@ -901,26 +871,20 @@ def expect_widget_update_target_with( ) end - it "raises an error if an outbound references field is not an `ID`" do - expect { - update_targets_for("Widget") do |t| - t.relates_to_one "workspace", "WidgetWorkspace", via: "workspace_id", dir: :out, references: "name" - end - }.to raise_error Errors::SchemaError, a_string_including( - "`Widget.workspace` uses `WidgetWorkspace.name` as the `references` field, but that field is not an `ID` field as expected." - ) - end - - it "does not raise an error if the inbound references field is inferred instead of explicitly defined" do + it "raises an error if a custom references field (not 'id') is used on an indexed type, since references can only be customized for embedded types" do expect { - update_targets_for("Widget", on_widget_workspace_type: ->(t) { t.field "widget_guid", "ID" }) do |t| - t.relates_to_one "workspace", "WidgetWorkspace", via: "widget_guid", dir: :in, references: "guid" + update_targets_for("Widget", on_widget_workspace_type: ->(t) { + t.field "guid", "ID" + }) do |t| + t.relates_to_one "workspace", "WidgetWorkspace", via: "workspace_id", dir: :out, references: "guid" t.field "workspace_name", "String" do |f| f.sourced_from "workspace", "name" end end - }.not_to raise_error + }.to raise_error Errors::SchemaError, a_string_including( + "uses `references: \"guid\"` on indexed type `WidgetWorkspace`, but the `references` parameter can only be customized for relationships to embedded types" + ) end it "allows a foreign key whose type is nested inside of an `object` array" do diff --git a/spec_support/lib/elastic_graph/spec_support/factories/widgets.rb b/spec_support/lib/elastic_graph/spec_support/factories/widgets.rb index 3c094eab6..df0b6f379 100644 --- a/spec_support/lib/elastic_graph/spec_support/factories/widgets.rb +++ b/spec_support/lib/elastic_graph/spec_support/factories/widgets.rb @@ -151,7 +151,6 @@ factory :manufacturer, parent: :indexed_type do __typename { "Manufacturer" } - guid { Faker::Alphanumeric.alpha(number: 20) } name { Faker::Company.name } created_at { Faker::Time.between(from: recent_date - 30, to: recent_date).utc.iso8601 } ceo { build(:person).as_embedded } @@ -191,7 +190,6 @@ factory :mechanical_part do __typename { "MechanicalPart" } - manufacturer_guid { manufacturer&.fetch(:guid) } material { Faker::Base.sample(["ALLOY", "CARBON_FIBER"]) } end end From 0d947799fc0b13197a59b808c7d65a18b06f866e Mon Sep 17 00:00:00 2001 From: ellisandrews-toast Date: Tue, 19 May 2026 20:19:25 -0400 Subject: [PATCH 4/6] Embedded type with references --- config/schema/artifacts/data_warehouse.yaml | 19 +- config/schema/artifacts/datastore_config.yaml | 64 + config/schema/artifacts/json_schemas.yaml | 76 + .../artifacts/json_schemas_by_version/v1.yaml | 106 ++ config/schema/artifacts/runtime_metadata.yaml | 497 +++++++ config/schema/artifacts/schema.graphql | 1218 +++++++++++++++- .../artifacts_with_apollo/data_warehouse.yaml | 19 +- .../datastore_config.yaml | 64 + .../artifacts_with_apollo/json_schemas.yaml | 76 + .../json_schemas_by_version/v1.yaml | 106 ++ .../runtime_metadata.yaml | 497 +++++++ .../artifacts_with_apollo/schema.graphql | 1220 ++++++++++++++++- config/schema/widgets.rb | 33 + config/settings/test.yaml.template | 2 + .../spec/acceptance/hidden_types_spec.rb | 3 + .../acceptance/nested_relationships_spec.rb | 75 +- .../spec_support/factories/widgets.rb | 28 + 17 files changed, 3961 insertions(+), 142 deletions(-) diff --git a/config/schema/artifacts/data_warehouse.yaml b/config/schema/artifacts/data_warehouse.yaml index 6f1c02601..1112fd9f4 100644 --- a/config/schema/artifacts/data_warehouse.yaml +++ b/config/schema/artifacts/data_warehouse.yaml @@ -49,6 +49,22 @@ tables: voltage INT, manufacturer_id STRING ) + inspection_notes: + table_schema: |- + CREATE TABLE IF NOT EXISTS inspection_notes ( + id STRING, + widget_inspection_guid STRING, + note STRING, + created_at TIMESTAMP + ) + inspection_summaries: + table_schema: |- + CREATE TABLE IF NOT EXISTS inspection_summaries ( + id STRING, + widget_inspection_guid STRING, + summary STRING, + created_at TIMESTAMP + ) manufacturers: table_schema: |- CREATE TABLE IF NOT EXISTS manufacturers ( @@ -161,5 +177,6 @@ tables: amounts ARRAY, fees ARRAY>, metadata STRING, - workspace_name STRING + workspace_name STRING, + inspection STRUCT ) diff --git a/config/schema/artifacts/datastore_config.yaml b/config/schema/artifacts/datastore_config.yaml index 7fd1aebc7..b044c647f 100644 --- a/config/schema/artifacts/datastore_config.yaml +++ b/config/schema/artifacts/datastore_config.yaml @@ -1458,6 +1458,10 @@ index_templates: type: keyword workspace_name: type: keyword + inspection: + properties: + guid: + type: keyword __counts: properties: release_timestamps: @@ -1670,6 +1674,66 @@ indices: index.number_of_replicas: 1 index.number_of_shards: 1 index.max_result_window: 10000 + inspection_notes: + aliases: {} + mappings: + dynamic: strict + properties: + id: + type: keyword + widget_inspection_guid: + type: keyword + note: + type: keyword + created_at: + type: date + format: strict_date_time + __sources: + type: keyword + __versions: + type: object + dynamic: 'false' + __typename: + type: constant_keyword + value: InspectionNote + _size: + enabled: true + settings: + index.mapping.ignore_malformed: false + index.mapping.coerce: false + index.number_of_replicas: 1 + index.number_of_shards: 1 + index.max_result_window: 10000 + inspection_summaries: + aliases: {} + mappings: + dynamic: strict + properties: + id: + type: keyword + widget_inspection_guid: + type: keyword + summary: + type: keyword + created_at: + type: date + format: strict_date_time + __sources: + type: keyword + __versions: + type: object + dynamic: 'false' + __typename: + type: constant_keyword + value: InspectionSummary + _size: + enabled: true + settings: + index.mapping.ignore_malformed: false + index.mapping.coerce: false + index.number_of_replicas: 1 + index.number_of_shards: 1 + index.max_result_window: 10000 manufacturers: aliases: {} mappings: diff --git a/config/schema/artifacts/json_schemas.yaml b/config/schema/artifacts/json_schemas.yaml index 64c6f7129..ecdf9062b 100644 --- a/config/schema/artifacts/json_schemas.yaml +++ b/config/schema/artifacts/json_schemas.yaml @@ -28,6 +28,8 @@ json_schema_version: 1 - Component - DirectWholesaler - ElectricalPart + - InspectionNote + - InspectionSummary - Manufacturer - MechanicalPart - OnlineStore @@ -372,6 +374,62 @@ json_schema_version: 1 - coordinates ID: type: string + InspectionNote: + type: object + properties: + id: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + widget_inspection_guid: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + note: + anyOf: + - allOf: + - "$ref": "#/$defs/String" + - maxLength: 8191 + - type: 'null' + created_at: + "$ref": "#/$defs/DateTime" + __typename: + type: string + const: InspectionNote + default: InspectionNote + required: + - id + - widget_inspection_guid + - note + - created_at + InspectionSummary: + type: object + properties: + id: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + widget_inspection_guid: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + summary: + anyOf: + - allOf: + - "$ref": "#/$defs/String" + - maxLength: 8191 + - type: 'null' + created_at: + "$ref": "#/$defs/DateTime" + __typename: + type: string + const: InspectionSummary + default: InspectionSummary + required: + - id + - widget_inspection_guid + - summary + - created_at Int: type: integer minimum: -2147483648 @@ -1068,6 +1126,10 @@ json_schema_version: 1 - "$ref": "#/$defs/Untyped" - maxLength: 8191 - type: 'null' + inspection: + anyOf: + - "$ref": "#/$defs/WidgetInspection" + - type: 'null' __typename: type: string const: Widget @@ -1105,8 +1167,22 @@ json_schema_version: 1 - amounts - fees - metadata + - inspection description: For more performant queries on this type, please filter on `workspace_id` if possible. + WidgetInspection: + type: object + properties: + guid: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + __typename: + type: string + const: WidgetInspection + default: WidgetInspection + required: + - guid WidgetInternalDetails: type: object properties: diff --git a/config/schema/artifacts/json_schemas_by_version/v1.yaml b/config/schema/artifacts/json_schemas_by_version/v1.yaml index ad09ed3e1..0cc9dd4ab 100644 --- a/config/schema/artifacts/json_schemas_by_version/v1.yaml +++ b/config/schema/artifacts/json_schemas_by_version/v1.yaml @@ -28,6 +28,8 @@ json_schema_version: 1 - Component - DirectWholesaler - ElectricalPart + - InspectionNote + - InspectionSummary - Manufacturer - MechanicalPart - OnlineStore @@ -471,6 +473,86 @@ json_schema_version: 1 - coordinates ID: type: string + InspectionNote: + type: object + properties: + id: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + ElasticGraph: + type: ID! + nameInIndex: id + widget_inspection_guid: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + ElasticGraph: + type: ID! + nameInIndex: widget_inspection_guid + note: + anyOf: + - allOf: + - "$ref": "#/$defs/String" + - maxLength: 8191 + - type: 'null' + ElasticGraph: + type: String + nameInIndex: note + created_at: + "$ref": "#/$defs/DateTime" + ElasticGraph: + type: DateTime! + nameInIndex: created_at + __typename: + type: string + const: InspectionNote + default: InspectionNote + required: + - id + - widget_inspection_guid + - note + - created_at + InspectionSummary: + type: object + properties: + id: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + ElasticGraph: + type: ID! + nameInIndex: id + widget_inspection_guid: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + ElasticGraph: + type: ID! + nameInIndex: widget_inspection_guid + summary: + anyOf: + - allOf: + - "$ref": "#/$defs/String" + - maxLength: 8191 + - type: 'null' + ElasticGraph: + type: String + nameInIndex: summary + created_at: + "$ref": "#/$defs/DateTime" + ElasticGraph: + type: DateTime! + nameInIndex: created_at + __typename: + type: string + const: InspectionSummary + default: InspectionSummary + required: + - id + - widget_inspection_guid + - summary + - created_at Int: type: integer minimum: -2147483648 @@ -1476,6 +1558,13 @@ json_schema_version: 1 ElasticGraph: type: Untyped nameInIndex: metadata + inspection: + anyOf: + - "$ref": "#/$defs/WidgetInspection" + - type: 'null' + ElasticGraph: + type: WidgetInspection + nameInIndex: inspection __typename: type: string const: Widget @@ -1513,8 +1602,25 @@ json_schema_version: 1 - amounts - fees - metadata + - inspection description: For more performant queries on this type, please filter on `workspace_id` if possible. + WidgetInspection: + type: object + properties: + guid: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + ElasticGraph: + type: ID! + nameInIndex: guid + __typename: + type: string + const: WidgetInspection + default: WidgetInspection + required: + - guid WidgetInternalDetails: type: object properties: diff --git a/config/schema/artifacts/runtime_metadata.yaml b/config/schema/artifacts/runtime_metadata.yaml index 651824d1e..144bbada2 100644 --- a/config/schema/artifacts/runtime_metadata.yaml +++ b/config/schema/artifacts/runtime_metadata.yaml @@ -235,6 +235,74 @@ enum_types_by_name: sort_field: direction: desc field_path: voltage + InspectionNoteSortOrderInput: + values_by_name: + created_at_ASC: + sort_field: + direction: asc + field_path: created_at + created_at_DESC: + sort_field: + direction: desc + field_path: created_at + id_ASC: + sort_field: + direction: asc + field_path: id + id_DESC: + sort_field: + direction: desc + field_path: id + note_ASC: + sort_field: + direction: asc + field_path: note + note_DESC: + sort_field: + direction: desc + field_path: note + widget_inspection_guid_ASC: + sort_field: + direction: asc + field_path: widget_inspection_guid + widget_inspection_guid_DESC: + sort_field: + direction: desc + field_path: widget_inspection_guid + InspectionSummarySortOrderInput: + values_by_name: + created_at_ASC: + sort_field: + direction: asc + field_path: created_at + created_at_DESC: + sort_field: + direction: desc + field_path: created_at + id_ASC: + sort_field: + direction: asc + field_path: id + id_DESC: + sort_field: + direction: desc + field_path: id + summary_ASC: + sort_field: + direction: asc + field_path: summary + summary_DESC: + sort_field: + direction: desc + field_path: summary + widget_inspection_guid_ASC: + sort_field: + direction: asc + field_path: widget_inspection_guid + widget_inspection_guid_DESC: + sort_field: + direction: desc + field_path: widget_inspection_guid InventorSortOrderInput: values_by_name: id_ASC: @@ -523,6 +591,14 @@ enum_types_by_name: sort_field: direction: desc field_path: id + inspection_guid_ASC: + sort_field: + direction: asc + field_path: inspection.guid + inspection_guid_DESC: + sort_field: + direction: desc + field_path: inspection.guid internal_details_name_ASC: sort_field: direction: asc @@ -1215,6 +1291,14 @@ enum_types_by_name: sort_field: direction: desc field_path: id + inspection_guid_ASC: + sort_field: + direction: asc + field_path: inspection.guid + inspection_guid_DESC: + sort_field: + direction: desc + field_path: inspection.guid internal_details_name_ASC: sort_field: direction: asc @@ -1537,6 +1621,14 @@ enum_types_by_name: sort_field: direction: desc field_path: id + inspection_guid_ASC: + sort_field: + direction: asc + field_path: inspection.guid + inspection_guid_DESC: + sort_field: + direction: desc + field_path: inspection.guid internal_details_name_ASC: sort_field: direction: asc @@ -1907,6 +1999,38 @@ index_definitions_by_name: voltage: source: __self route_with: id + inspection_notes: + current_sources: + - __self + default_sort_fields: + - direction: desc + field_path: created_at + fields_by_path: + created_at: + source: __self + id: + source: __self + note: + source: __self + widget_inspection_guid: + source: __self + route_with: id + inspection_summaries: + current_sources: + - __self + default_sort_fields: + - direction: desc + field_path: created_at + fields_by_path: + created_at: + source: __self + id: + source: __self + summary: + source: __self + widget_inspection_guid: + source: __self + route_with: id manufacturers: current_sources: - __self @@ -2977,6 +3101,8 @@ index_definitions_by_name: source: __self id: source: __self + inspection.guid: + source: __self internal_details.name: source: __self internal_highlightable_details.name: @@ -4063,6 +4189,286 @@ object_types_by_name: graphql_fields_by_name: count: name_in_index: __counts + InspectionNote: + graphql_fields_by_name: + created_at: + resolver: + name: get_record_field_value + id: + resolver: + name: get_record_field_value + note: + resolver: + name: get_record_field_value + widget_inspection_guid: + resolver: + name: get_record_field_value + index_definition_names: + - inspection_notes + update_targets: + - data_params: + created_at: + cardinality: one + note: + cardinality: one + widget_inspection_guid: + cardinality: one + id_source: id + metadata_params: + relationship: + value: __self + sourceId: + cardinality: one + source_path: id + sourceType: + cardinality: one + source_path: type + version: + cardinality: one + relationship: __self + routing_value_source: id + script_id: update_index_data_1fdfaf1c9261c96019decc89b515bd9a + type: InspectionNote + InspectionNoteAggregatedValues: + graphql_fields_by_name: + created_at: + resolver: + name: object_with_lookahead + id: + resolver: + name: object_with_lookahead + note: + resolver: + name: object_with_lookahead + widget_inspection_guid: + resolver: + name: object_with_lookahead + InspectionNoteAggregation: + elasticgraph_category: indexed_aggregation + graphql_fields_by_name: + aggregated_values: + resolver: + name: object_without_lookahead + count: + resolver: + name: object_without_lookahead + grouped_by: + resolver: + name: object_without_lookahead + source_type: InspectionNote + InspectionNoteAggregationConnection: + elasticgraph_category: relay_connection + graphql_fields_by_name: + edges: + resolver: + name: object_without_lookahead + nodes: + resolver: + name: object_without_lookahead + page_info: + resolver: + name: object_without_lookahead + InspectionNoteAggregationEdge: + elasticgraph_category: relay_edge + graphql_fields_by_name: + cursor: + resolver: + name: object_without_lookahead + node: + resolver: + name: object_without_lookahead + InspectionNoteConnection: + elasticgraph_category: relay_connection + graphql_fields_by_name: + edges: + resolver: + name: object_without_lookahead + nodes: + resolver: + name: object_without_lookahead + page_info: + resolver: + name: object_without_lookahead + total_edge_count: + resolver: + name: object_without_lookahead + InspectionNoteEdge: + elasticgraph_category: relay_edge + graphql_fields_by_name: + all_highlights: + resolver: + name: object_without_lookahead + cursor: + resolver: + name: object_without_lookahead + highlights: + resolver: + name: object_without_lookahead + node: + resolver: + name: object_without_lookahead + InspectionNoteGroupedBy: + graphql_fields_by_name: + created_at: + resolver: + name: object_with_lookahead + note: + resolver: + name: object_with_lookahead + widget_inspection_guid: + resolver: + name: object_with_lookahead + InspectionNoteHighlights: + graphql_fields_by_name: + id: + resolver: + name: get_record_field_value + note: + resolver: + name: get_record_field_value + widget_inspection_guid: + resolver: + name: get_record_field_value + InspectionSummary: + graphql_fields_by_name: + created_at: + resolver: + name: get_record_field_value + id: + resolver: + name: get_record_field_value + summary: + resolver: + name: get_record_field_value + widget_inspection_guid: + resolver: + name: get_record_field_value + index_definition_names: + - inspection_summaries + update_targets: + - data_params: + created_at: + cardinality: one + summary: + cardinality: one + widget_inspection_guid: + cardinality: one + id_source: id + metadata_params: + relationship: + value: __self + sourceId: + cardinality: one + source_path: id + sourceType: + cardinality: one + source_path: type + version: + cardinality: one + relationship: __self + routing_value_source: id + script_id: update_index_data_1fdfaf1c9261c96019decc89b515bd9a + type: InspectionSummary + InspectionSummaryAggregatedValues: + graphql_fields_by_name: + created_at: + resolver: + name: object_with_lookahead + id: + resolver: + name: object_with_lookahead + summary: + resolver: + name: object_with_lookahead + widget_inspection_guid: + resolver: + name: object_with_lookahead + InspectionSummaryAggregation: + elasticgraph_category: indexed_aggregation + graphql_fields_by_name: + aggregated_values: + resolver: + name: object_without_lookahead + count: + resolver: + name: object_without_lookahead + grouped_by: + resolver: + name: object_without_lookahead + source_type: InspectionSummary + InspectionSummaryAggregationConnection: + elasticgraph_category: relay_connection + graphql_fields_by_name: + edges: + resolver: + name: object_without_lookahead + nodes: + resolver: + name: object_without_lookahead + page_info: + resolver: + name: object_without_lookahead + InspectionSummaryAggregationEdge: + elasticgraph_category: relay_edge + graphql_fields_by_name: + cursor: + resolver: + name: object_without_lookahead + node: + resolver: + name: object_without_lookahead + InspectionSummaryConnection: + elasticgraph_category: relay_connection + graphql_fields_by_name: + edges: + resolver: + name: object_without_lookahead + nodes: + resolver: + name: object_without_lookahead + page_info: + resolver: + name: object_without_lookahead + total_edge_count: + resolver: + name: object_without_lookahead + InspectionSummaryEdge: + elasticgraph_category: relay_edge + graphql_fields_by_name: + all_highlights: + resolver: + name: object_without_lookahead + cursor: + resolver: + name: object_without_lookahead + highlights: + resolver: + name: object_without_lookahead + node: + resolver: + name: object_without_lookahead + InspectionSummaryGroupedBy: + graphql_fields_by_name: + created_at: + resolver: + name: object_with_lookahead + summary: + resolver: + name: object_with_lookahead + widget_inspection_guid: + resolver: + name: object_with_lookahead + InspectionSummaryHighlights: + graphql_fields_by_name: + id: + resolver: + name: get_record_field_value + summary: + resolver: + name: get_record_field_value + widget_inspection_guid: + resolver: + name: get_record_field_value IntAggregatedValues: elasticgraph_category: scalar_aggregated_values graphql_fields_by_name: @@ -4787,6 +5193,9 @@ object_types_by_name: id: resolver: name: get_record_field_value + inspection: + resolver: + name: get_record_field_value internal_details: resolver: name: get_record_field_value @@ -4980,6 +5389,9 @@ object_types_by_name: id: resolver: name: object_with_lookahead + inspection: + resolver: + name: object_with_lookahead internal_details: resolver: name: object_with_lookahead @@ -5188,6 +5600,9 @@ object_types_by_name: fees: resolver: name: object_with_lookahead + inspection: + resolver: + name: object_with_lookahead internal_details: resolver: name: object_with_lookahead @@ -5299,6 +5714,9 @@ object_types_by_name: id: resolver: name: get_record_field_value + inspection: + resolver: + name: get_record_field_value internal_highlightable_details: resolver: name: get_record_field_value @@ -6048,6 +6466,18 @@ object_types_by_name: electrical_parts: resolver: name: indexed_type_root_fields + inspection_note_aggregations: + resolver: + name: indexed_type_root_fields + inspection_notes: + resolver: + name: indexed_type_root_fields + inspection_summaries: + resolver: + name: indexed_type_root_fields + inspection_summary_aggregations: + resolver: + name: indexed_type_root_fields inventor_aggregations: resolver: name: indexed_type_root_fields @@ -7675,6 +8105,9 @@ object_types_by_name: id: resolver: name: get_record_field_value + inspection: + resolver: + name: get_record_field_value internal_details: resolver: name: get_record_field_value @@ -7799,6 +8232,8 @@ object_types_by_name: cardinality: one fees: cardinality: one + inspection: + cardinality: one internal_details: cardinality: one internal_highlightable_details: @@ -7930,6 +8365,9 @@ object_types_by_name: id: resolver: name: object_with_lookahead + inspection: + resolver: + name: object_with_lookahead internal_details: resolver: name: object_with_lookahead @@ -8364,6 +8802,9 @@ object_types_by_name: fees: resolver: name: object_with_lookahead + inspection: + resolver: + name: object_with_lookahead internal_details: resolver: name: object_with_lookahead @@ -8450,6 +8891,9 @@ object_types_by_name: id: resolver: name: get_record_field_value + inspection: + resolver: + name: get_record_field_value internal_highlightable_details: resolver: name: get_record_field_value @@ -8492,6 +8936,47 @@ object_types_by_name: workspace_name: resolver: name: get_record_field_value + WidgetInspection: + graphql_fields_by_name: + guid: + resolver: + name: get_record_field_value + inspection_note_aggregations: + relation: + direction: in + foreign_key: widget_inspection_guid + referenced_field_name: guid + resolver: + name: nested_relationships + inspection_notes: + relation: + direction: in + foreign_key: widget_inspection_guid + referenced_field_name: guid + resolver: + name: nested_relationships + inspection_summary: + relation: + direction: in + foreign_key: widget_inspection_guid + referenced_field_name: guid + resolver: + name: nested_relationships + WidgetInspectionAggregatedValues: + graphql_fields_by_name: + guid: + resolver: + name: object_with_lookahead + WidgetInspectionGroupedBy: + graphql_fields_by_name: + guid: + resolver: + name: object_with_lookahead + WidgetInspectionHighlights: + graphql_fields_by_name: + guid: + resolver: + name: get_record_field_value WidgetInternalDetailsAggregatedValues: graphql_fields_by_name: name: @@ -8664,6 +9149,9 @@ object_types_by_name: id: resolver: name: get_record_field_value + inspection: + resolver: + name: get_record_field_value internal_details: resolver: name: get_record_field_value @@ -8792,6 +9280,9 @@ object_types_by_name: id: resolver: name: object_with_lookahead + inspection: + resolver: + name: object_with_lookahead internal_details: resolver: name: object_with_lookahead @@ -8979,6 +9470,9 @@ object_types_by_name: full_address: resolver: name: object_with_lookahead + inspection: + resolver: + name: object_with_lookahead internal_details: resolver: name: object_with_lookahead @@ -9071,6 +9565,9 @@ object_types_by_name: id: resolver: name: get_record_field_value + inspection: + resolver: + name: get_record_field_value internal_highlightable_details: resolver: name: get_record_field_value diff --git a/config/schema/artifacts/schema.graphql b/config/schema/artifacts/schema.graphql index 3c6220fba..a9daf348e 100644 --- a/config/schema/artifacts/schema.graphql +++ b/config/schema/artifacts/schema.graphql @@ -3574,6 +3574,610 @@ input IDListFilterInput { not: IDListFilterInput } +type InspectionNote { + created_at: DateTime! + id: ID! + note: String + widget_inspection_guid: ID! +} + +""" +Type used to perform aggregation computations on `InspectionNote` fields. +""" +type InspectionNoteAggregatedValues { + """ + Computed aggregate values for the `created_at` field. + """ + created_at: DateTimeAggregatedValues + + """ + Computed aggregate values for the `id` field. + """ + id: NonNumericAggregatedValues + + """ + Computed aggregate values for the `note` field. + """ + note: NonNumericAggregatedValues + + """ + Computed aggregate values for the `widget_inspection_guid` field. + """ + widget_inspection_guid: NonNumericAggregatedValues +} + +""" +Return type representing a bucket of `InspectionNote` documents for an aggregations query. +""" +type InspectionNoteAggregation { + """ + Provides computed aggregated values over all `InspectionNote` documents in an aggregation bucket. + """ + aggregated_values: InspectionNoteAggregatedValues + + """ + The count of `InspectionNote` documents in an aggregation bucket. + """ + count: JsonSafeLong! + + """ + Used to specify the `InspectionNote` fields to group by. The returned values identify each aggregation bucket. + """ + grouped_by: InspectionNoteGroupedBy +} + +""" +Represents a paginated collection of `InspectionNoteAggregation` results. + +See the [Relay GraphQL Cursor Connections +Specification](https://relay.dev/graphql/connections.htm#sec-Connection-Types) for more info. +""" +type InspectionNoteAggregationConnection { + """ + Wraps a specific `InspectionNoteAggregation` to pair it with its pagination cursor. + """ + edges: [InspectionNoteAggregationEdge!]! + + """ + The list of `InspectionNoteAggregation` results. + """ + nodes: [InspectionNoteAggregation!]! + + """ + Provides pagination-related information. + """ + page_info: PageInfo! +} + +""" +Represents a specific `InspectionNoteAggregation` in the context of a `InspectionNoteAggregationConnection`, +providing access to both the `InspectionNoteAggregation` and query-specific information such as the pagination `Cursor`. + +See the [Relay GraphQL Cursor Connections +Specification](https://relay.dev/graphql/connections.htm#sec-Edge-Types) for more info. +""" +type InspectionNoteAggregationEdge { + """ + The `Cursor` of this `InspectionNoteAggregation`. This can be passed in the next query as + a `before` or `after` argument to continue paginating from this `InspectionNoteAggregation`. + """ + cursor: Cursor + + """ + The `InspectionNoteAggregation` of this edge. + """ + node: InspectionNoteAggregation +} + +""" +Represents a paginated collection of `InspectionNote` results. + +See the [Relay GraphQL Cursor Connections +Specification](https://relay.dev/graphql/connections.htm#sec-Connection-Types) for more info. +""" +type InspectionNoteConnection { + """ + Wraps a specific `InspectionNote` to pair it with its pagination cursor. + """ + edges: [InspectionNoteEdge!]! + + """ + The list of `InspectionNote` results. + """ + nodes: [InspectionNote!]! + + """ + Provides pagination-related information. + """ + page_info: PageInfo! + + """ + The total number of edges available in this connection to paginate over. + """ + total_edge_count: JsonSafeLong! +} + +""" +Represents a specific `InspectionNote` in the context of a `InspectionNoteConnection`, +providing access to both the `InspectionNote` and query-specific information such as the pagination `Cursor`. + +See the [Relay GraphQL Cursor Connections +Specification](https://relay.dev/graphql/connections.htm#sec-Edge-Types) for more info. +""" +type InspectionNoteEdge { + """ + All search highlights for this `InspectionNote`, indicating where in the indexed document the query matched. + """ + all_highlights: [SearchHighlight!]! + + """ + The `Cursor` of this `InspectionNote`. This can be passed in the next query as + a `before` or `after` argument to continue paginating from this `InspectionNote`. + """ + cursor: Cursor + + """ + Specific search highlights for this `InspectionNote`, providing matching snippets for the requested fields. + """ + highlights: InspectionNoteHighlights + + """ + The `InspectionNote` of this edge. + """ + node: InspectionNote +} + +""" +Input type used to specify filters on `InspectionNote` fields. + +Will match all documents if passed as an empty object (or as `null`). +""" +input InspectionNoteFilterInput { + """ + Matches records where all of the provided sub-filters evaluate to true. This works just like an AND operator in SQL. + + Note: multiple filters are automatically ANDed together. This is only needed when you have multiple filters that can't + be provided on a single `InspectionNoteFilterInput` input because of + collisions between key names. For example, if you want to AND multiple + OR'd sub-filters (the equivalent of (A OR B) AND (C OR D)), you could do all_of: [{any_of: [...]}, {any_of: [...]}]. + + When `null` or an empty list is passed, matches all documents. + """ + all_of: [InspectionNoteFilterInput!] + + """ + Matches records where any of the provided sub-filters evaluate to true. + This works just like an OR operator in SQL. + + When `null` is passed, matches all documents. + When an empty list is passed, this part of the filter matches no documents. + """ + any_of: [InspectionNoteFilterInput!] + + """ + Used to filter on the `created_at` field. + + When `null` or an empty object is passed, matches all documents. + """ + created_at: DateTimeFilterInput + + """ + Used to filter on the `id` field. + + When `null` or an empty object is passed, matches all documents. + """ + id: IDFilterInput + + """ + Matches records where the provided sub-filter evaluates to false. + This works just like a NOT operator in SQL. + + When `null` or an empty object is passed, matches no documents. + """ + not: InspectionNoteFilterInput + + """ + Used to filter on the `note` field. + + When `null` or an empty object is passed, matches all documents. + """ + note: StringFilterInput + + """ + Used to filter on the `widget_inspection_guid` field. + + When `null` or an empty object is passed, matches all documents. + """ + widget_inspection_guid: IDFilterInput +} + +""" +Type used to specify the `InspectionNote` fields to group by for aggregations. +""" +type InspectionNoteGroupedBy { + """ + Offers the different grouping options for the `created_at` value within this group. + """ + created_at: DateTimeGroupedBy + + """ + The `note` field value for this group. + """ + note: String + + """ + The `widget_inspection_guid` field value for this group. + """ + widget_inspection_guid: ID +} + +""" +Type used to request desired `InspectionNote` search highlight fields. +""" +type InspectionNoteHighlights { + """ + Search highlights for the `id`, providing snippets of the matching text. + """ + id: [String!]! + + """ + Search highlights for the `note`, providing snippets of the matching text. + """ + note: [String!]! + + """ + Search highlights for the `widget_inspection_guid`, providing snippets of the matching text. + """ + widget_inspection_guid: [String!]! +} + +""" +Enumerates the ways `InspectionNote`s can be sorted. +""" +enum InspectionNoteSortOrderInput { + """ + Sorts ascending by the `created_at` field. + """ + created_at_ASC + + """ + Sorts descending by the `created_at` field. + """ + created_at_DESC + + """ + Sorts ascending by the `id` field. + """ + id_ASC + + """ + Sorts descending by the `id` field. + """ + id_DESC + + """ + Sorts ascending by the `note` field. + """ + note_ASC + + """ + Sorts descending by the `note` field. + """ + note_DESC + + """ + Sorts ascending by the `widget_inspection_guid` field. + """ + widget_inspection_guid_ASC + + """ + Sorts descending by the `widget_inspection_guid` field. + """ + widget_inspection_guid_DESC +} + +type InspectionSummary { + created_at: DateTime! + id: ID! + summary: String + widget_inspection_guid: ID! +} + +""" +Type used to perform aggregation computations on `InspectionSummary` fields. +""" +type InspectionSummaryAggregatedValues { + """ + Computed aggregate values for the `created_at` field. + """ + created_at: DateTimeAggregatedValues + + """ + Computed aggregate values for the `id` field. + """ + id: NonNumericAggregatedValues + + """ + Computed aggregate values for the `summary` field. + """ + summary: NonNumericAggregatedValues + + """ + Computed aggregate values for the `widget_inspection_guid` field. + """ + widget_inspection_guid: NonNumericAggregatedValues +} + +""" +Return type representing a bucket of `InspectionSummary` documents for an aggregations query. +""" +type InspectionSummaryAggregation { + """ + Provides computed aggregated values over all `InspectionSummary` documents in an aggregation bucket. + """ + aggregated_values: InspectionSummaryAggregatedValues + + """ + The count of `InspectionSummary` documents in an aggregation bucket. + """ + count: JsonSafeLong! + + """ + Used to specify the `InspectionSummary` fields to group by. The returned values identify each aggregation bucket. + """ + grouped_by: InspectionSummaryGroupedBy +} + +""" +Represents a paginated collection of `InspectionSummaryAggregation` results. + +See the [Relay GraphQL Cursor Connections +Specification](https://relay.dev/graphql/connections.htm#sec-Connection-Types) for more info. +""" +type InspectionSummaryAggregationConnection { + """ + Wraps a specific `InspectionSummaryAggregation` to pair it with its pagination cursor. + """ + edges: [InspectionSummaryAggregationEdge!]! + + """ + The list of `InspectionSummaryAggregation` results. + """ + nodes: [InspectionSummaryAggregation!]! + + """ + Provides pagination-related information. + """ + page_info: PageInfo! +} + +""" +Represents a specific `InspectionSummaryAggregation` in the context of a `InspectionSummaryAggregationConnection`, +providing access to both the `InspectionSummaryAggregation` and query-specific information such as the pagination `Cursor`. + +See the [Relay GraphQL Cursor Connections +Specification](https://relay.dev/graphql/connections.htm#sec-Edge-Types) for more info. +""" +type InspectionSummaryAggregationEdge { + """ + The `Cursor` of this `InspectionSummaryAggregation`. This can be passed in the next query as + a `before` or `after` argument to continue paginating from this `InspectionSummaryAggregation`. + """ + cursor: Cursor + + """ + The `InspectionSummaryAggregation` of this edge. + """ + node: InspectionSummaryAggregation +} + +""" +Represents a paginated collection of `InspectionSummary` results. + +See the [Relay GraphQL Cursor Connections +Specification](https://relay.dev/graphql/connections.htm#sec-Connection-Types) for more info. +""" +type InspectionSummaryConnection { + """ + Wraps a specific `InspectionSummary` to pair it with its pagination cursor. + """ + edges: [InspectionSummaryEdge!]! + + """ + The list of `InspectionSummary` results. + """ + nodes: [InspectionSummary!]! + + """ + Provides pagination-related information. + """ + page_info: PageInfo! + + """ + The total number of edges available in this connection to paginate over. + """ + total_edge_count: JsonSafeLong! +} + +""" +Represents a specific `InspectionSummary` in the context of a `InspectionSummaryConnection`, +providing access to both the `InspectionSummary` and query-specific information such as the pagination `Cursor`. + +See the [Relay GraphQL Cursor Connections +Specification](https://relay.dev/graphql/connections.htm#sec-Edge-Types) for more info. +""" +type InspectionSummaryEdge { + """ + All search highlights for this `InspectionSummary`, indicating where in the indexed document the query matched. + """ + all_highlights: [SearchHighlight!]! + + """ + The `Cursor` of this `InspectionSummary`. This can be passed in the next query as + a `before` or `after` argument to continue paginating from this `InspectionSummary`. + """ + cursor: Cursor + + """ + Specific search highlights for this `InspectionSummary`, providing matching snippets for the requested fields. + """ + highlights: InspectionSummaryHighlights + + """ + The `InspectionSummary` of this edge. + """ + node: InspectionSummary +} + +""" +Input type used to specify filters on `InspectionSummary` fields. + +Will match all documents if passed as an empty object (or as `null`). +""" +input InspectionSummaryFilterInput { + """ + Matches records where all of the provided sub-filters evaluate to true. This works just like an AND operator in SQL. + + Note: multiple filters are automatically ANDed together. This is only needed when you have multiple filters that can't + be provided on a single `InspectionSummaryFilterInput` input because of + collisions between key names. For example, if you want to AND multiple + OR'd sub-filters (the equivalent of (A OR B) AND (C OR D)), you could do all_of: [{any_of: [...]}, {any_of: [...]}]. + + When `null` or an empty list is passed, matches all documents. + """ + all_of: [InspectionSummaryFilterInput!] + + """ + Matches records where any of the provided sub-filters evaluate to true. + This works just like an OR operator in SQL. + + When `null` is passed, matches all documents. + When an empty list is passed, this part of the filter matches no documents. + """ + any_of: [InspectionSummaryFilterInput!] + + """ + Used to filter on the `created_at` field. + + When `null` or an empty object is passed, matches all documents. + """ + created_at: DateTimeFilterInput + + """ + Used to filter on the `id` field. + + When `null` or an empty object is passed, matches all documents. + """ + id: IDFilterInput + + """ + Matches records where the provided sub-filter evaluates to false. + This works just like a NOT operator in SQL. + + When `null` or an empty object is passed, matches no documents. + """ + not: InspectionSummaryFilterInput + + """ + Used to filter on the `summary` field. + + When `null` or an empty object is passed, matches all documents. + """ + summary: StringFilterInput + + """ + Used to filter on the `widget_inspection_guid` field. + + When `null` or an empty object is passed, matches all documents. + """ + widget_inspection_guid: IDFilterInput +} + +""" +Type used to specify the `InspectionSummary` fields to group by for aggregations. +""" +type InspectionSummaryGroupedBy { + """ + Offers the different grouping options for the `created_at` value within this group. + """ + created_at: DateTimeGroupedBy + + """ + The `summary` field value for this group. + """ + summary: String + + """ + The `widget_inspection_guid` field value for this group. + """ + widget_inspection_guid: ID +} + +""" +Type used to request desired `InspectionSummary` search highlight fields. +""" +type InspectionSummaryHighlights { + """ + Search highlights for the `id`, providing snippets of the matching text. + """ + id: [String!]! + + """ + Search highlights for the `summary`, providing snippets of the matching text. + """ + summary: [String!]! + + """ + Search highlights for the `widget_inspection_guid`, providing snippets of the matching text. + """ + widget_inspection_guid: [String!]! +} + +""" +Enumerates the ways `InspectionSummary`s can be sorted. +""" +enum InspectionSummarySortOrderInput { + """ + Sorts ascending by the `created_at` field. + """ + created_at_ASC + + """ + Sorts descending by the `created_at` field. + """ + created_at_DESC + + """ + Sorts ascending by the `id` field. + """ + id_ASC + + """ + Sorts descending by the `id` field. + """ + id_DESC + + """ + Sorts ascending by the `summary` field. + """ + summary_ASC + + """ + Sorts descending by the `summary` field. + """ + summary_DESC + + """ + Sorts ascending by the `widget_inspection_guid` field. + """ + widget_inspection_guid_ASC + + """ + Sorts descending by the `widget_inspection_guid` field. + """ + widget_inspection_guid_DESC +} + """ A return type used from aggregations to provided aggregated values over `Int` fields. """ @@ -6013,6 +6617,11 @@ type NamedEntityAggregatedValues { """ id: NonNumericAggregatedValues + """ + Computed aggregate values for the `inspection` field. + """ + inspection: WidgetInspectionAggregatedValues + """ Computed aggregate values for the `internal_details` field. """ @@ -6419,6 +7028,13 @@ input NamedEntityFilterInput { """ id: IDFilterInput + """ + Used to filter on the `inspection` field. + + When `null` or an empty object is passed, matches all documents. + """ + inspection: WidgetInspectionFilterInput + """ Used to filter on the `internal_details` field. @@ -6698,6 +7314,11 @@ type NamedEntityGroupedBy { """ fees: MoneyGroupedBy + """ + The `inspection` field value for this group. + """ + inspection: WidgetInspectionGroupedBy + """ The `internal_details` field value for this group. """ @@ -6892,6 +7513,11 @@ type NamedEntityHighlights { """ id: [String!]! + """ + Search highlights for the `inspection`, providing snippets of the matching text. + """ + inspection: WidgetInspectionHighlights + """ Search highlights for the `internal_highlightable_details`, providing snippets of the matching text. """ @@ -7162,6 +7788,16 @@ enum NamedEntitySortOrderInput { """ id_DESC + """ + Sorts ascending by the `inspection.guid` field. + """ + inspection_guid_ASC + + """ + Sorts descending by the `inspection.guid` field. + """ + inspection_guid_DESC + """ Sorts ascending by the `internal_details.name` field. """ @@ -9364,14 +10000,220 @@ type Query { Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. """ last: Int - ): ComponentAggregationConnection + ): ComponentAggregationConnection + + """ + Fetches `Component`s based on the provided arguments. + """ + components( + """ + Used to forward-paginate through the `components`. When provided, the next page after the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + after: Cursor + + """ + Used to backward-paginate through the `components`. When provided, the previous page before the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + before: Cursor + + """ + Used to filter the returned `components` based on the provided criteria. + """ + filter: ComponentFilterInput + + """ + Used in conjunction with the `after` argument to forward-paginate through the `components`. + When provided, limits the number of returned results to the first `n` after the provided + `after` cursor (or from the start of the `components`, if no `after` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + first: Int + + """ + Used in conjunction with the `before` argument to backward-paginate through the `components`. + When provided, limits the number of returned results to the last `n` before the provided + `before` cursor (or from the end of the `components`, if no `before` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + last: Int + + """ + Used to specify how the returned `components` should be sorted. + """ + order_by: [ComponentSortOrderInput!] + ): ComponentConnection + + """ + Aggregations over the `distribution_channels` data: + + > Fetches `DistributionChannel`s based on the provided arguments. + """ + distribution_channel_aggregations( + """ + Used to forward-paginate through the `distribution_channel_aggregations`. When provided, the next page after the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + after: Cursor + + """ + Used to backward-paginate through the `distribution_channel_aggregations`. When provided, the previous page before the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + before: Cursor + + """ + Used to filter the `DistributionChannel` documents that get aggregated over based on the provided criteria. + """ + filter: DistributionChannelFilterInput + + """ + Used in conjunction with the `after` argument to forward-paginate through the `distribution_channel_aggregations`. + When provided, limits the number of returned results to the first `n` after the provided + `after` cursor (or from the start of the `distribution_channel_aggregations`, if no `after` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + first: Int + + """ + Used in conjunction with the `before` argument to backward-paginate through the `distribution_channel_aggregations`. + When provided, limits the number of returned results to the last `n` before the provided + `before` cursor (or from the end of the `distribution_channel_aggregations`, if no `before` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + last: Int + ): DistributionChannelAggregationConnection + + """ + Fetches `DistributionChannel`s based on the provided arguments. + """ + distribution_channels( + """ + Used to forward-paginate through the `distribution_channels`. When provided, the next page after the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + after: Cursor + + """ + Used to backward-paginate through the `distribution_channels`. When provided, the previous page before the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + before: Cursor + + """ + Used to filter the returned `distribution_channels` based on the provided criteria. + """ + filter: DistributionChannelFilterInput + + """ + Used in conjunction with the `after` argument to forward-paginate through the `distribution_channels`. + When provided, limits the number of returned results to the first `n` after the provided + `after` cursor (or from the start of the `distribution_channels`, if no `after` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + first: Int + + """ + Used in conjunction with the `before` argument to backward-paginate through the `distribution_channels`. + When provided, limits the number of returned results to the last `n` before the provided + `before` cursor (or from the end of the `distribution_channels`, if no `before` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + last: Int + + """ + Used to specify how the returned `distribution_channels` should be sorted. + """ + order_by: [DistributionChannelSortOrderInput!] + ): DistributionChannelConnection + + """ + Aggregations over the `electrical_parts` data: + + > Fetches `ElectricalPart`s based on the provided arguments. + """ + electrical_part_aggregations( + """ + Used to forward-paginate through the `electrical_part_aggregations`. When provided, the next page after the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + after: Cursor + + """ + Used to backward-paginate through the `electrical_part_aggregations`. When provided, the previous page before the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + before: Cursor + + """ + Used to filter the `ElectricalPart` documents that get aggregated over based on the provided criteria. + """ + filter: ElectricalPartFilterInput + + """ + Used in conjunction with the `after` argument to forward-paginate through the `electrical_part_aggregations`. + When provided, limits the number of returned results to the first `n` after the provided + `after` cursor (or from the start of the `electrical_part_aggregations`, if no `after` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + first: Int + + """ + Used in conjunction with the `before` argument to backward-paginate through the `electrical_part_aggregations`. + When provided, limits the number of returned results to the last `n` before the provided + `before` cursor (or from the end of the `electrical_part_aggregations`, if no `before` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + last: Int + ): ElectricalPartAggregationConnection """ - Fetches `Component`s based on the provided arguments. + Fetches `ElectricalPart`s based on the provided arguments. """ - components( + electrical_parts( """ - Used to forward-paginate through the `components`. When provided, the next page after the + Used to forward-paginate through the `electrical_parts`. When provided, the next page after the provided cursor will be returned. See the [Relay GraphQL Cursor Connections @@ -9380,7 +10222,7 @@ type Query { after: Cursor """ - Used to backward-paginate through the `components`. When provided, the previous page before the + Used to backward-paginate through the `electrical_parts`. When provided, the previous page before the provided cursor will be returned. See the [Relay GraphQL Cursor Connections @@ -9389,14 +10231,14 @@ type Query { before: Cursor """ - Used to filter the returned `components` based on the provided criteria. + Used to filter the returned `electrical_parts` based on the provided criteria. """ - filter: ComponentFilterInput + filter: ElectricalPartFilterInput """ - Used in conjunction with the `after` argument to forward-paginate through the `components`. + Used in conjunction with the `after` argument to forward-paginate through the `electrical_parts`. When provided, limits the number of returned results to the first `n` after the provided - `after` cursor (or from the start of the `components`, if no `after` cursor is provided). + `after` cursor (or from the start of the `electrical_parts`, if no `after` cursor is provided). See the [Relay GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. @@ -9404,9 +10246,9 @@ type Query { first: Int """ - Used in conjunction with the `before` argument to backward-paginate through the `components`. + Used in conjunction with the `before` argument to backward-paginate through the `electrical_parts`. When provided, limits the number of returned results to the last `n` before the provided - `before` cursor (or from the end of the `components`, if no `before` cursor is provided). + `before` cursor (or from the end of the `electrical_parts`, if no `before` cursor is provided). See the [Relay GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. @@ -9414,19 +10256,19 @@ type Query { last: Int """ - Used to specify how the returned `components` should be sorted. + Used to specify how the returned `electrical_parts` should be sorted. """ - order_by: [ComponentSortOrderInput!] - ): ComponentConnection + order_by: [ElectricalPartSortOrderInput!] + ): ElectricalPartConnection """ - Aggregations over the `distribution_channels` data: + Aggregations over the `inspection_notes` data: - > Fetches `DistributionChannel`s based on the provided arguments. + > Fetches `InspectionNote`s based on the provided arguments. """ - distribution_channel_aggregations( + inspection_note_aggregations( """ - Used to forward-paginate through the `distribution_channel_aggregations`. When provided, the next page after the + Used to forward-paginate through the `inspection_note_aggregations`. When provided, the next page after the provided cursor will be returned. See the [Relay GraphQL Cursor Connections @@ -9435,7 +10277,7 @@ type Query { after: Cursor """ - Used to backward-paginate through the `distribution_channel_aggregations`. When provided, the previous page before the + Used to backward-paginate through the `inspection_note_aggregations`. When provided, the previous page before the provided cursor will be returned. See the [Relay GraphQL Cursor Connections @@ -9444,14 +10286,14 @@ type Query { before: Cursor """ - Used to filter the `DistributionChannel` documents that get aggregated over based on the provided criteria. + Used to filter the `InspectionNote` documents that get aggregated over based on the provided criteria. """ - filter: DistributionChannelFilterInput + filter: InspectionNoteFilterInput """ - Used in conjunction with the `after` argument to forward-paginate through the `distribution_channel_aggregations`. + Used in conjunction with the `after` argument to forward-paginate through the `inspection_note_aggregations`. When provided, limits the number of returned results to the first `n` after the provided - `after` cursor (or from the start of the `distribution_channel_aggregations`, if no `after` cursor is provided). + `after` cursor (or from the start of the `inspection_note_aggregations`, if no `after` cursor is provided). See the [Relay GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. @@ -9459,22 +10301,22 @@ type Query { first: Int """ - Used in conjunction with the `before` argument to backward-paginate through the `distribution_channel_aggregations`. + Used in conjunction with the `before` argument to backward-paginate through the `inspection_note_aggregations`. When provided, limits the number of returned results to the last `n` before the provided - `before` cursor (or from the end of the `distribution_channel_aggregations`, if no `before` cursor is provided). + `before` cursor (or from the end of the `inspection_note_aggregations`, if no `before` cursor is provided). See the [Relay GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. """ last: Int - ): DistributionChannelAggregationConnection + ): InspectionNoteAggregationConnection """ - Fetches `DistributionChannel`s based on the provided arguments. + Fetches `InspectionNote`s based on the provided arguments. """ - distribution_channels( + inspection_notes( """ - Used to forward-paginate through the `distribution_channels`. When provided, the next page after the + Used to forward-paginate through the `inspection_notes`. When provided, the next page after the provided cursor will be returned. See the [Relay GraphQL Cursor Connections @@ -9483,7 +10325,7 @@ type Query { after: Cursor """ - Used to backward-paginate through the `distribution_channels`. When provided, the previous page before the + Used to backward-paginate through the `inspection_notes`. When provided, the previous page before the provided cursor will be returned. See the [Relay GraphQL Cursor Connections @@ -9492,14 +10334,14 @@ type Query { before: Cursor """ - Used to filter the returned `distribution_channels` based on the provided criteria. + Used to filter the returned `inspection_notes` based on the provided criteria. """ - filter: DistributionChannelFilterInput + filter: InspectionNoteFilterInput """ - Used in conjunction with the `after` argument to forward-paginate through the `distribution_channels`. + Used in conjunction with the `after` argument to forward-paginate through the `inspection_notes`. When provided, limits the number of returned results to the first `n` after the provided - `after` cursor (or from the start of the `distribution_channels`, if no `after` cursor is provided). + `after` cursor (or from the start of the `inspection_notes`, if no `after` cursor is provided). See the [Relay GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. @@ -9507,9 +10349,9 @@ type Query { first: Int """ - Used in conjunction with the `before` argument to backward-paginate through the `distribution_channels`. + Used in conjunction with the `before` argument to backward-paginate through the `inspection_notes`. When provided, limits the number of returned results to the last `n` before the provided - `before` cursor (or from the end of the `distribution_channels`, if no `before` cursor is provided). + `before` cursor (or from the end of the `inspection_notes`, if no `before` cursor is provided). See the [Relay GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. @@ -9517,19 +10359,17 @@ type Query { last: Int """ - Used to specify how the returned `distribution_channels` should be sorted. + Used to specify how the returned `inspection_notes` should be sorted. """ - order_by: [DistributionChannelSortOrderInput!] - ): DistributionChannelConnection + order_by: [InspectionNoteSortOrderInput!] + ): InspectionNoteConnection """ - Aggregations over the `electrical_parts` data: - - > Fetches `ElectricalPart`s based on the provided arguments. + Fetches `InspectionSummary`s based on the provided arguments. """ - electrical_part_aggregations( + inspection_summaries( """ - Used to forward-paginate through the `electrical_part_aggregations`. When provided, the next page after the + Used to forward-paginate through the `inspection_summaries`. When provided, the next page after the provided cursor will be returned. See the [Relay GraphQL Cursor Connections @@ -9538,7 +10378,7 @@ type Query { after: Cursor """ - Used to backward-paginate through the `electrical_part_aggregations`. When provided, the previous page before the + Used to backward-paginate through the `inspection_summaries`. When provided, the previous page before the provided cursor will be returned. See the [Relay GraphQL Cursor Connections @@ -9547,14 +10387,14 @@ type Query { before: Cursor """ - Used to filter the `ElectricalPart` documents that get aggregated over based on the provided criteria. + Used to filter the returned `inspection_summaries` based on the provided criteria. """ - filter: ElectricalPartFilterInput + filter: InspectionSummaryFilterInput """ - Used in conjunction with the `after` argument to forward-paginate through the `electrical_part_aggregations`. + Used in conjunction with the `after` argument to forward-paginate through the `inspection_summaries`. When provided, limits the number of returned results to the first `n` after the provided - `after` cursor (or from the start of the `electrical_part_aggregations`, if no `after` cursor is provided). + `after` cursor (or from the start of the `inspection_summaries`, if no `after` cursor is provided). See the [Relay GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. @@ -9562,22 +10402,29 @@ type Query { first: Int """ - Used in conjunction with the `before` argument to backward-paginate through the `electrical_part_aggregations`. + Used in conjunction with the `before` argument to backward-paginate through the `inspection_summaries`. When provided, limits the number of returned results to the last `n` before the provided - `before` cursor (or from the end of the `electrical_part_aggregations`, if no `before` cursor is provided). + `before` cursor (or from the end of the `inspection_summaries`, if no `before` cursor is provided). See the [Relay GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. """ last: Int - ): ElectricalPartAggregationConnection + + """ + Used to specify how the returned `inspection_summaries` should be sorted. + """ + order_by: [InspectionSummarySortOrderInput!] + ): InspectionSummaryConnection """ - Fetches `ElectricalPart`s based on the provided arguments. + Aggregations over the `inspection_summaries` data: + + > Fetches `InspectionSummary`s based on the provided arguments. """ - electrical_parts( + inspection_summary_aggregations( """ - Used to forward-paginate through the `electrical_parts`. When provided, the next page after the + Used to forward-paginate through the `inspection_summary_aggregations`. When provided, the next page after the provided cursor will be returned. See the [Relay GraphQL Cursor Connections @@ -9586,7 +10433,7 @@ type Query { after: Cursor """ - Used to backward-paginate through the `electrical_parts`. When provided, the previous page before the + Used to backward-paginate through the `inspection_summary_aggregations`. When provided, the previous page before the provided cursor will be returned. See the [Relay GraphQL Cursor Connections @@ -9595,14 +10442,14 @@ type Query { before: Cursor """ - Used to filter the returned `electrical_parts` based on the provided criteria. + Used to filter the `InspectionSummary` documents that get aggregated over based on the provided criteria. """ - filter: ElectricalPartFilterInput + filter: InspectionSummaryFilterInput """ - Used in conjunction with the `after` argument to forward-paginate through the `electrical_parts`. + Used in conjunction with the `after` argument to forward-paginate through the `inspection_summary_aggregations`. When provided, limits the number of returned results to the first `n` after the provided - `after` cursor (or from the start of the `electrical_parts`, if no `after` cursor is provided). + `after` cursor (or from the start of the `inspection_summary_aggregations`, if no `after` cursor is provided). See the [Relay GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. @@ -9610,20 +10457,15 @@ type Query { first: Int """ - Used in conjunction with the `before` argument to backward-paginate through the `electrical_parts`. + Used in conjunction with the `before` argument to backward-paginate through the `inspection_summary_aggregations`. When provided, limits the number of returned results to the last `n` before the provided - `before` cursor (or from the end of the `electrical_parts`, if no `before` cursor is provided). + `before` cursor (or from the end of the `inspection_summary_aggregations`, if no `before` cursor is provided). See the [Relay GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. """ last: Int - - """ - Used to specify how the returned `electrical_parts` should be sorted. - """ - order_by: [ElectricalPartSortOrderInput!] - ): ElectricalPartConnection + ): InspectionSummaryAggregationConnection """ Aggregations over the `inventors` data: @@ -15648,6 +16490,7 @@ type Widget implements NamedEntity { description: String fees: [Money!]! id: ID! + inspection: WidgetInspection inventor: Inventor metadata: Untyped name: String @@ -15744,6 +16587,11 @@ type WidgetAggregatedValues { """ id: NonNumericAggregatedValues + """ + Computed aggregate values for the `inspection` field. + """ + inspection: WidgetInspectionAggregatedValues + """ Computed aggregate values for the `internal_details` field. """ @@ -16715,6 +17563,13 @@ input WidgetFilterInput { """ id: IDFilterInput + """ + Used to filter on the `inspection` field. + + When `null` or an empty object is passed, matches all documents. + """ + inspection: WidgetInspectionFilterInput + """ Used to filter on the `internal_details` field. @@ -16933,6 +17788,11 @@ type WidgetGroupedBy { """ fees: MoneyGroupedBy + """ + The `inspection` field value for this group. + """ + inspection: WidgetInspectionGroupedBy + """ The `internal_details` field value for this group. """ @@ -17087,6 +17947,11 @@ type WidgetHighlights { """ id: [String!]! + """ + Search highlights for the `inspection`, providing snippets of the matching text. + """ + inspection: WidgetInspectionHighlights + """ Search highlights for the `internal_highlightable_details`, providing snippets of the matching text. """ @@ -17153,6 +18018,181 @@ type WidgetHighlights { workspace_name: [String!]! } +type WidgetInspection { + guid: ID! + + """ + Aggregations over the `inspection_notes` data. + """ + inspection_note_aggregations( + """ + Used to forward-paginate through the `inspection_note_aggregations`. When provided, the next page after the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + after: Cursor + + """ + Used to backward-paginate through the `inspection_note_aggregations`. When provided, the previous page before the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + before: Cursor + + """ + Used to filter the `InspectionNote` documents that get aggregated over based on the provided criteria. + """ + filter: InspectionNoteFilterInput + + """ + Used in conjunction with the `after` argument to forward-paginate through the `inspection_note_aggregations`. + When provided, limits the number of returned results to the first `n` after the provided + `after` cursor (or from the start of the `inspection_note_aggregations`, if no `after` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + first: Int + + """ + Used in conjunction with the `before` argument to backward-paginate through the `inspection_note_aggregations`. + When provided, limits the number of returned results to the last `n` before the provided + `before` cursor (or from the end of the `inspection_note_aggregations`, if no `before` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + last: Int + ): InspectionNoteAggregationConnection + inspection_notes( + """ + Used to forward-paginate through the `inspection_notes`. When provided, the next page after the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + after: Cursor + + """ + Used to backward-paginate through the `inspection_notes`. When provided, the previous page before the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + before: Cursor + + """ + Used to filter the returned `inspection_notes` based on the provided criteria. + """ + filter: InspectionNoteFilterInput + + """ + Used in conjunction with the `after` argument to forward-paginate through the `inspection_notes`. + When provided, limits the number of returned results to the first `n` after the provided + `after` cursor (or from the start of the `inspection_notes`, if no `after` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + first: Int + + """ + Used in conjunction with the `before` argument to backward-paginate through the `inspection_notes`. + When provided, limits the number of returned results to the last `n` before the provided + `before` cursor (or from the end of the `inspection_notes`, if no `before` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + last: Int + + """ + Used to specify how the returned `inspection_notes` should be sorted. + """ + order_by: [InspectionNoteSortOrderInput!] + ): InspectionNoteConnection + inspection_summary: InspectionSummary +} + +""" +Type used to perform aggregation computations on `WidgetInspection` fields. +""" +type WidgetInspectionAggregatedValues { + """ + Computed aggregate values for the `guid` field. + """ + guid: NonNumericAggregatedValues +} + +""" +Input type used to specify filters on `WidgetInspection` fields. + +Will match all documents if passed as an empty object (or as `null`). +""" +input WidgetInspectionFilterInput { + """ + Matches records where all of the provided sub-filters evaluate to true. This works just like an AND operator in SQL. + + Note: multiple filters are automatically ANDed together. This is only needed when you have multiple filters that can't + be provided on a single `WidgetInspectionFilterInput` input because of + collisions between key names. For example, if you want to AND multiple + OR'd sub-filters (the equivalent of (A OR B) AND (C OR D)), you could do all_of: [{any_of: [...]}, {any_of: [...]}]. + + When `null` or an empty list is passed, matches all documents. + """ + all_of: [WidgetInspectionFilterInput!] + + """ + Matches records where any of the provided sub-filters evaluate to true. + This works just like an OR operator in SQL. + + When `null` is passed, matches all documents. + When an empty list is passed, this part of the filter matches no documents. + """ + any_of: [WidgetInspectionFilterInput!] + + """ + Used to filter on the `guid` field. + + When `null` or an empty object is passed, matches all documents. + """ + guid: IDFilterInput + + """ + Matches records where the provided sub-filter evaluates to false. + This works just like a NOT operator in SQL. + + When `null` or an empty object is passed, matches no documents. + """ + not: WidgetInspectionFilterInput +} + +""" +Type used to specify the `WidgetInspection` fields to group by for aggregations. +""" +type WidgetInspectionGroupedBy { + """ + The `guid` field value for this group. + """ + guid: ID +} + +""" +Type used to request desired `WidgetInspection` search highlight fields. +""" +type WidgetInspectionHighlights { + """ + Search highlights for the `guid`, providing snippets of the matching text. + """ + guid: [String!]! +} + """ Type used to perform aggregation computations on `WidgetInternalDetails` fields. """ @@ -17543,6 +18583,11 @@ type WidgetOrAddressAggregatedValues { """ id: NonNumericAggregatedValues + """ + Computed aggregate values for the `inspection` field. + """ + inspection: WidgetInspectionAggregatedValues + """ Computed aggregate values for the `internal_details` field. """ @@ -17926,6 +18971,13 @@ input WidgetOrAddressFilterInput { """ id: IDFilterInput + """ + Used to filter on the `inspection` field. + + When `null` or an empty object is passed, matches all documents. + """ + inspection: WidgetInspectionFilterInput + """ Used to filter on the `internal_details` field. @@ -18156,6 +19208,11 @@ type WidgetOrAddressGroupedBy { """ full_address: String + """ + The `inspection` field value for this group. + """ + inspection: WidgetInspectionGroupedBy + """ The `internal_details` field value for this group. """ @@ -18320,6 +19377,11 @@ type WidgetOrAddressHighlights { """ id: [String!]! + """ + Search highlights for the `inspection`, providing snippets of the matching text. + """ + inspection: WidgetInspectionHighlights + """ Search highlights for the `internal_highlightable_details`, providing snippets of the matching text. """ @@ -18540,6 +19602,16 @@ enum WidgetOrAddressSortOrderInput { """ id_DESC + """ + Sorts ascending by the `inspection.guid` field. + """ + inspection_guid_ASC + + """ + Sorts descending by the `inspection.guid` field. + """ + inspection_guid_DESC + """ Sorts ascending by the `internal_details.name` field. """ @@ -18945,6 +20017,16 @@ enum WidgetSortOrderInput { """ id_DESC + """ + Sorts ascending by the `inspection.guid` field. + """ + inspection_guid_ASC + + """ + Sorts descending by the `inspection.guid` field. + """ + inspection_guid_DESC + """ Sorts ascending by the `internal_details.name` field. """ diff --git a/config/schema/artifacts_with_apollo/data_warehouse.yaml b/config/schema/artifacts_with_apollo/data_warehouse.yaml index 6f1c02601..1112fd9f4 100644 --- a/config/schema/artifacts_with_apollo/data_warehouse.yaml +++ b/config/schema/artifacts_with_apollo/data_warehouse.yaml @@ -49,6 +49,22 @@ tables: voltage INT, manufacturer_id STRING ) + inspection_notes: + table_schema: |- + CREATE TABLE IF NOT EXISTS inspection_notes ( + id STRING, + widget_inspection_guid STRING, + note STRING, + created_at TIMESTAMP + ) + inspection_summaries: + table_schema: |- + CREATE TABLE IF NOT EXISTS inspection_summaries ( + id STRING, + widget_inspection_guid STRING, + summary STRING, + created_at TIMESTAMP + ) manufacturers: table_schema: |- CREATE TABLE IF NOT EXISTS manufacturers ( @@ -161,5 +177,6 @@ tables: amounts ARRAY, fees ARRAY>, metadata STRING, - workspace_name STRING + workspace_name STRING, + inspection STRUCT ) diff --git a/config/schema/artifacts_with_apollo/datastore_config.yaml b/config/schema/artifacts_with_apollo/datastore_config.yaml index 7fd1aebc7..b044c647f 100644 --- a/config/schema/artifacts_with_apollo/datastore_config.yaml +++ b/config/schema/artifacts_with_apollo/datastore_config.yaml @@ -1458,6 +1458,10 @@ index_templates: type: keyword workspace_name: type: keyword + inspection: + properties: + guid: + type: keyword __counts: properties: release_timestamps: @@ -1670,6 +1674,66 @@ indices: index.number_of_replicas: 1 index.number_of_shards: 1 index.max_result_window: 10000 + inspection_notes: + aliases: {} + mappings: + dynamic: strict + properties: + id: + type: keyword + widget_inspection_guid: + type: keyword + note: + type: keyword + created_at: + type: date + format: strict_date_time + __sources: + type: keyword + __versions: + type: object + dynamic: 'false' + __typename: + type: constant_keyword + value: InspectionNote + _size: + enabled: true + settings: + index.mapping.ignore_malformed: false + index.mapping.coerce: false + index.number_of_replicas: 1 + index.number_of_shards: 1 + index.max_result_window: 10000 + inspection_summaries: + aliases: {} + mappings: + dynamic: strict + properties: + id: + type: keyword + widget_inspection_guid: + type: keyword + summary: + type: keyword + created_at: + type: date + format: strict_date_time + __sources: + type: keyword + __versions: + type: object + dynamic: 'false' + __typename: + type: constant_keyword + value: InspectionSummary + _size: + enabled: true + settings: + index.mapping.ignore_malformed: false + index.mapping.coerce: false + index.number_of_replicas: 1 + index.number_of_shards: 1 + index.max_result_window: 10000 manufacturers: aliases: {} mappings: diff --git a/config/schema/artifacts_with_apollo/json_schemas.yaml b/config/schema/artifacts_with_apollo/json_schemas.yaml index 64c6f7129..ecdf9062b 100644 --- a/config/schema/artifacts_with_apollo/json_schemas.yaml +++ b/config/schema/artifacts_with_apollo/json_schemas.yaml @@ -28,6 +28,8 @@ json_schema_version: 1 - Component - DirectWholesaler - ElectricalPart + - InspectionNote + - InspectionSummary - Manufacturer - MechanicalPart - OnlineStore @@ -372,6 +374,62 @@ json_schema_version: 1 - coordinates ID: type: string + InspectionNote: + type: object + properties: + id: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + widget_inspection_guid: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + note: + anyOf: + - allOf: + - "$ref": "#/$defs/String" + - maxLength: 8191 + - type: 'null' + created_at: + "$ref": "#/$defs/DateTime" + __typename: + type: string + const: InspectionNote + default: InspectionNote + required: + - id + - widget_inspection_guid + - note + - created_at + InspectionSummary: + type: object + properties: + id: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + widget_inspection_guid: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + summary: + anyOf: + - allOf: + - "$ref": "#/$defs/String" + - maxLength: 8191 + - type: 'null' + created_at: + "$ref": "#/$defs/DateTime" + __typename: + type: string + const: InspectionSummary + default: InspectionSummary + required: + - id + - widget_inspection_guid + - summary + - created_at Int: type: integer minimum: -2147483648 @@ -1068,6 +1126,10 @@ json_schema_version: 1 - "$ref": "#/$defs/Untyped" - maxLength: 8191 - type: 'null' + inspection: + anyOf: + - "$ref": "#/$defs/WidgetInspection" + - type: 'null' __typename: type: string const: Widget @@ -1105,8 +1167,22 @@ json_schema_version: 1 - amounts - fees - metadata + - inspection description: For more performant queries on this type, please filter on `workspace_id` if possible. + WidgetInspection: + type: object + properties: + guid: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + __typename: + type: string + const: WidgetInspection + default: WidgetInspection + required: + - guid WidgetInternalDetails: type: object properties: diff --git a/config/schema/artifacts_with_apollo/json_schemas_by_version/v1.yaml b/config/schema/artifacts_with_apollo/json_schemas_by_version/v1.yaml index ad09ed3e1..0cc9dd4ab 100644 --- a/config/schema/artifacts_with_apollo/json_schemas_by_version/v1.yaml +++ b/config/schema/artifacts_with_apollo/json_schemas_by_version/v1.yaml @@ -28,6 +28,8 @@ json_schema_version: 1 - Component - DirectWholesaler - ElectricalPart + - InspectionNote + - InspectionSummary - Manufacturer - MechanicalPart - OnlineStore @@ -471,6 +473,86 @@ json_schema_version: 1 - coordinates ID: type: string + InspectionNote: + type: object + properties: + id: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + ElasticGraph: + type: ID! + nameInIndex: id + widget_inspection_guid: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + ElasticGraph: + type: ID! + nameInIndex: widget_inspection_guid + note: + anyOf: + - allOf: + - "$ref": "#/$defs/String" + - maxLength: 8191 + - type: 'null' + ElasticGraph: + type: String + nameInIndex: note + created_at: + "$ref": "#/$defs/DateTime" + ElasticGraph: + type: DateTime! + nameInIndex: created_at + __typename: + type: string + const: InspectionNote + default: InspectionNote + required: + - id + - widget_inspection_guid + - note + - created_at + InspectionSummary: + type: object + properties: + id: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + ElasticGraph: + type: ID! + nameInIndex: id + widget_inspection_guid: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + ElasticGraph: + type: ID! + nameInIndex: widget_inspection_guid + summary: + anyOf: + - allOf: + - "$ref": "#/$defs/String" + - maxLength: 8191 + - type: 'null' + ElasticGraph: + type: String + nameInIndex: summary + created_at: + "$ref": "#/$defs/DateTime" + ElasticGraph: + type: DateTime! + nameInIndex: created_at + __typename: + type: string + const: InspectionSummary + default: InspectionSummary + required: + - id + - widget_inspection_guid + - summary + - created_at Int: type: integer minimum: -2147483648 @@ -1476,6 +1558,13 @@ json_schema_version: 1 ElasticGraph: type: Untyped nameInIndex: metadata + inspection: + anyOf: + - "$ref": "#/$defs/WidgetInspection" + - type: 'null' + ElasticGraph: + type: WidgetInspection + nameInIndex: inspection __typename: type: string const: Widget @@ -1513,8 +1602,25 @@ json_schema_version: 1 - amounts - fees - metadata + - inspection description: For more performant queries on this type, please filter on `workspace_id` if possible. + WidgetInspection: + type: object + properties: + guid: + allOf: + - "$ref": "#/$defs/ID" + - maxLength: 8191 + ElasticGraph: + type: ID! + nameInIndex: guid + __typename: + type: string + const: WidgetInspection + default: WidgetInspection + required: + - guid WidgetInternalDetails: type: object properties: diff --git a/config/schema/artifacts_with_apollo/runtime_metadata.yaml b/config/schema/artifacts_with_apollo/runtime_metadata.yaml index 69cfafb47..2081fcf6e 100644 --- a/config/schema/artifacts_with_apollo/runtime_metadata.yaml +++ b/config/schema/artifacts_with_apollo/runtime_metadata.yaml @@ -235,6 +235,74 @@ enum_types_by_name: sort_field: direction: desc field_path: voltage + InspectionNoteSortOrderInput: + values_by_name: + created_at_ASC: + sort_field: + direction: asc + field_path: created_at + created_at_DESC: + sort_field: + direction: desc + field_path: created_at + id_ASC: + sort_field: + direction: asc + field_path: id + id_DESC: + sort_field: + direction: desc + field_path: id + note_ASC: + sort_field: + direction: asc + field_path: note + note_DESC: + sort_field: + direction: desc + field_path: note + widget_inspection_guid_ASC: + sort_field: + direction: asc + field_path: widget_inspection_guid + widget_inspection_guid_DESC: + sort_field: + direction: desc + field_path: widget_inspection_guid + InspectionSummarySortOrderInput: + values_by_name: + created_at_ASC: + sort_field: + direction: asc + field_path: created_at + created_at_DESC: + sort_field: + direction: desc + field_path: created_at + id_ASC: + sort_field: + direction: asc + field_path: id + id_DESC: + sort_field: + direction: desc + field_path: id + summary_ASC: + sort_field: + direction: asc + field_path: summary + summary_DESC: + sort_field: + direction: desc + field_path: summary + widget_inspection_guid_ASC: + sort_field: + direction: asc + field_path: widget_inspection_guid + widget_inspection_guid_DESC: + sort_field: + direction: desc + field_path: widget_inspection_guid InventorSortOrderInput: values_by_name: id_ASC: @@ -523,6 +591,14 @@ enum_types_by_name: sort_field: direction: desc field_path: id + inspection_guid_ASC: + sort_field: + direction: asc + field_path: inspection.guid + inspection_guid_DESC: + sort_field: + direction: desc + field_path: inspection.guid internal_details_name_ASC: sort_field: direction: asc @@ -1215,6 +1291,14 @@ enum_types_by_name: sort_field: direction: desc field_path: id + inspection_guid_ASC: + sort_field: + direction: asc + field_path: inspection.guid + inspection_guid_DESC: + sort_field: + direction: desc + field_path: inspection.guid internal_details_name_ASC: sort_field: direction: asc @@ -1537,6 +1621,14 @@ enum_types_by_name: sort_field: direction: desc field_path: id + inspection_guid_ASC: + sort_field: + direction: asc + field_path: inspection.guid + inspection_guid_DESC: + sort_field: + direction: desc + field_path: inspection.guid internal_details_name_ASC: sort_field: direction: asc @@ -1936,6 +2028,38 @@ index_definitions_by_name: voltage: source: __self route_with: id + inspection_notes: + current_sources: + - __self + default_sort_fields: + - direction: desc + field_path: created_at + fields_by_path: + created_at: + source: __self + id: + source: __self + note: + source: __self + widget_inspection_guid: + source: __self + route_with: id + inspection_summaries: + current_sources: + - __self + default_sort_fields: + - direction: desc + field_path: created_at + fields_by_path: + created_at: + source: __self + id: + source: __self + summary: + source: __self + widget_inspection_guid: + source: __self + route_with: id manufacturers: current_sources: - __self @@ -3006,6 +3130,8 @@ index_definitions_by_name: source: __self id: source: __self + inspection.guid: + source: __self internal_details.name: source: __self internal_highlightable_details.name: @@ -4167,6 +4293,286 @@ object_types_by_name: graphql_fields_by_name: count: name_in_index: __counts + InspectionNote: + graphql_fields_by_name: + created_at: + resolver: + name: get_record_field_value + id: + resolver: + name: get_record_field_value + note: + resolver: + name: get_record_field_value + widget_inspection_guid: + resolver: + name: get_record_field_value + index_definition_names: + - inspection_notes + update_targets: + - data_params: + created_at: + cardinality: one + note: + cardinality: one + widget_inspection_guid: + cardinality: one + id_source: id + metadata_params: + relationship: + value: __self + sourceId: + cardinality: one + source_path: id + sourceType: + cardinality: one + source_path: type + version: + cardinality: one + relationship: __self + routing_value_source: id + script_id: update_index_data_1fdfaf1c9261c96019decc89b515bd9a + type: InspectionNote + InspectionNoteAggregatedValues: + graphql_fields_by_name: + created_at: + resolver: + name: object_with_lookahead + id: + resolver: + name: object_with_lookahead + note: + resolver: + name: object_with_lookahead + widget_inspection_guid: + resolver: + name: object_with_lookahead + InspectionNoteAggregation: + elasticgraph_category: indexed_aggregation + graphql_fields_by_name: + aggregated_values: + resolver: + name: object_without_lookahead + count: + resolver: + name: object_without_lookahead + grouped_by: + resolver: + name: object_without_lookahead + source_type: InspectionNote + InspectionNoteAggregationConnection: + elasticgraph_category: relay_connection + graphql_fields_by_name: + edges: + resolver: + name: object_without_lookahead + nodes: + resolver: + name: object_without_lookahead + page_info: + resolver: + name: object_without_lookahead + InspectionNoteAggregationEdge: + elasticgraph_category: relay_edge + graphql_fields_by_name: + cursor: + resolver: + name: object_without_lookahead + node: + resolver: + name: object_without_lookahead + InspectionNoteConnection: + elasticgraph_category: relay_connection + graphql_fields_by_name: + edges: + resolver: + name: object_without_lookahead + nodes: + resolver: + name: object_without_lookahead + page_info: + resolver: + name: object_without_lookahead + total_edge_count: + resolver: + name: object_without_lookahead + InspectionNoteEdge: + elasticgraph_category: relay_edge + graphql_fields_by_name: + all_highlights: + resolver: + name: object_without_lookahead + cursor: + resolver: + name: object_without_lookahead + highlights: + resolver: + name: object_without_lookahead + node: + resolver: + name: object_without_lookahead + InspectionNoteGroupedBy: + graphql_fields_by_name: + created_at: + resolver: + name: object_with_lookahead + note: + resolver: + name: object_with_lookahead + widget_inspection_guid: + resolver: + name: object_with_lookahead + InspectionNoteHighlights: + graphql_fields_by_name: + id: + resolver: + name: get_record_field_value + note: + resolver: + name: get_record_field_value + widget_inspection_guid: + resolver: + name: get_record_field_value + InspectionSummary: + graphql_fields_by_name: + created_at: + resolver: + name: get_record_field_value + id: + resolver: + name: get_record_field_value + summary: + resolver: + name: get_record_field_value + widget_inspection_guid: + resolver: + name: get_record_field_value + index_definition_names: + - inspection_summaries + update_targets: + - data_params: + created_at: + cardinality: one + summary: + cardinality: one + widget_inspection_guid: + cardinality: one + id_source: id + metadata_params: + relationship: + value: __self + sourceId: + cardinality: one + source_path: id + sourceType: + cardinality: one + source_path: type + version: + cardinality: one + relationship: __self + routing_value_source: id + script_id: update_index_data_1fdfaf1c9261c96019decc89b515bd9a + type: InspectionSummary + InspectionSummaryAggregatedValues: + graphql_fields_by_name: + created_at: + resolver: + name: object_with_lookahead + id: + resolver: + name: object_with_lookahead + summary: + resolver: + name: object_with_lookahead + widget_inspection_guid: + resolver: + name: object_with_lookahead + InspectionSummaryAggregation: + elasticgraph_category: indexed_aggregation + graphql_fields_by_name: + aggregated_values: + resolver: + name: object_without_lookahead + count: + resolver: + name: object_without_lookahead + grouped_by: + resolver: + name: object_without_lookahead + source_type: InspectionSummary + InspectionSummaryAggregationConnection: + elasticgraph_category: relay_connection + graphql_fields_by_name: + edges: + resolver: + name: object_without_lookahead + nodes: + resolver: + name: object_without_lookahead + page_info: + resolver: + name: object_without_lookahead + InspectionSummaryAggregationEdge: + elasticgraph_category: relay_edge + graphql_fields_by_name: + cursor: + resolver: + name: object_without_lookahead + node: + resolver: + name: object_without_lookahead + InspectionSummaryConnection: + elasticgraph_category: relay_connection + graphql_fields_by_name: + edges: + resolver: + name: object_without_lookahead + nodes: + resolver: + name: object_without_lookahead + page_info: + resolver: + name: object_without_lookahead + total_edge_count: + resolver: + name: object_without_lookahead + InspectionSummaryEdge: + elasticgraph_category: relay_edge + graphql_fields_by_name: + all_highlights: + resolver: + name: object_without_lookahead + cursor: + resolver: + name: object_without_lookahead + highlights: + resolver: + name: object_without_lookahead + node: + resolver: + name: object_without_lookahead + InspectionSummaryGroupedBy: + graphql_fields_by_name: + created_at: + resolver: + name: object_with_lookahead + summary: + resolver: + name: object_with_lookahead + widget_inspection_guid: + resolver: + name: object_with_lookahead + InspectionSummaryHighlights: + graphql_fields_by_name: + id: + resolver: + name: get_record_field_value + summary: + resolver: + name: get_record_field_value + widget_inspection_guid: + resolver: + name: get_record_field_value IntAggregatedValues: elasticgraph_category: scalar_aggregated_values graphql_fields_by_name: @@ -4891,6 +5297,9 @@ object_types_by_name: id: resolver: name: get_record_field_value + inspection: + resolver: + name: get_record_field_value internal_details: resolver: name: get_record_field_value @@ -5105,6 +5514,9 @@ object_types_by_name: id: resolver: name: object_with_lookahead + inspection: + resolver: + name: object_with_lookahead internal_details: resolver: name: object_with_lookahead @@ -5313,6 +5725,9 @@ object_types_by_name: fees: resolver: name: object_with_lookahead + inspection: + resolver: + name: object_with_lookahead internal_details: resolver: name: object_with_lookahead @@ -5424,6 +5839,9 @@ object_types_by_name: id: resolver: name: get_record_field_value + inspection: + resolver: + name: get_record_field_value internal_highlightable_details: resolver: name: get_record_field_value @@ -6179,6 +6597,18 @@ object_types_by_name: electrical_parts: resolver: name: indexed_type_root_fields + inspection_note_aggregations: + resolver: + name: indexed_type_root_fields + inspection_notes: + resolver: + name: indexed_type_root_fields + inspection_summaries: + resolver: + name: indexed_type_root_fields + inspection_summary_aggregations: + resolver: + name: indexed_type_root_fields inventor_aggregations: resolver: name: indexed_type_root_fields @@ -7806,6 +8236,9 @@ object_types_by_name: id: resolver: name: get_record_field_value + inspection: + resolver: + name: get_record_field_value internal_details: resolver: name: get_record_field_value @@ -7930,6 +8363,8 @@ object_types_by_name: cardinality: one fees: cardinality: one + inspection: + cardinality: one internal_details: cardinality: one internal_highlightable_details: @@ -8061,6 +8496,9 @@ object_types_by_name: id: resolver: name: object_with_lookahead + inspection: + resolver: + name: object_with_lookahead internal_details: resolver: name: object_with_lookahead @@ -8495,6 +8933,9 @@ object_types_by_name: fees: resolver: name: object_with_lookahead + inspection: + resolver: + name: object_with_lookahead internal_details: resolver: name: object_with_lookahead @@ -8581,6 +9022,9 @@ object_types_by_name: id: resolver: name: get_record_field_value + inspection: + resolver: + name: get_record_field_value internal_highlightable_details: resolver: name: get_record_field_value @@ -8623,6 +9067,47 @@ object_types_by_name: workspace_name: resolver: name: get_record_field_value + WidgetInspection: + graphql_fields_by_name: + guid: + resolver: + name: get_record_field_value + inspection_note_aggregations: + relation: + direction: in + foreign_key: widget_inspection_guid + referenced_field_name: guid + resolver: + name: nested_relationships + inspection_notes: + relation: + direction: in + foreign_key: widget_inspection_guid + referenced_field_name: guid + resolver: + name: nested_relationships + inspection_summary: + relation: + direction: in + foreign_key: widget_inspection_guid + referenced_field_name: guid + resolver: + name: nested_relationships + WidgetInspectionAggregatedValues: + graphql_fields_by_name: + guid: + resolver: + name: object_with_lookahead + WidgetInspectionGroupedBy: + graphql_fields_by_name: + guid: + resolver: + name: object_with_lookahead + WidgetInspectionHighlights: + graphql_fields_by_name: + guid: + resolver: + name: get_record_field_value WidgetInternalDetailsAggregatedValues: graphql_fields_by_name: name: @@ -8795,6 +9280,9 @@ object_types_by_name: id: resolver: name: get_record_field_value + inspection: + resolver: + name: get_record_field_value internal_details: resolver: name: get_record_field_value @@ -8923,6 +9411,9 @@ object_types_by_name: id: resolver: name: object_with_lookahead + inspection: + resolver: + name: object_with_lookahead internal_details: resolver: name: object_with_lookahead @@ -9110,6 +9601,9 @@ object_types_by_name: full_address: resolver: name: object_with_lookahead + inspection: + resolver: + name: object_with_lookahead internal_details: resolver: name: object_with_lookahead @@ -9202,6 +9696,9 @@ object_types_by_name: id: resolver: name: get_record_field_value + inspection: + resolver: + name: get_record_field_value internal_highlightable_details: resolver: name: get_record_field_value diff --git a/config/schema/artifacts_with_apollo/schema.graphql b/config/schema/artifacts_with_apollo/schema.graphql index 7f97bcee0..d1e9c906e 100644 --- a/config/schema/artifacts_with_apollo/schema.graphql +++ b/config/schema/artifacts_with_apollo/schema.graphql @@ -3856,6 +3856,610 @@ input IDListFilterInput { not: IDListFilterInput } +type InspectionNote @key(fields: "id") { + created_at: DateTime! + id: ID! + note: String + widget_inspection_guid: ID! +} + +""" +Type used to perform aggregation computations on `InspectionNote` fields. +""" +type InspectionNoteAggregatedValues { + """ + Computed aggregate values for the `created_at` field. + """ + created_at: DateTimeAggregatedValues + + """ + Computed aggregate values for the `id` field. + """ + id: NonNumericAggregatedValues + + """ + Computed aggregate values for the `note` field. + """ + note: NonNumericAggregatedValues + + """ + Computed aggregate values for the `widget_inspection_guid` field. + """ + widget_inspection_guid: NonNumericAggregatedValues +} + +""" +Return type representing a bucket of `InspectionNote` documents for an aggregations query. +""" +type InspectionNoteAggregation { + """ + Provides computed aggregated values over all `InspectionNote` documents in an aggregation bucket. + """ + aggregated_values: InspectionNoteAggregatedValues + + """ + The count of `InspectionNote` documents in an aggregation bucket. + """ + count: JsonSafeLong! + + """ + Used to specify the `InspectionNote` fields to group by. The returned values identify each aggregation bucket. + """ + grouped_by: InspectionNoteGroupedBy +} + +""" +Represents a paginated collection of `InspectionNoteAggregation` results. + +See the [Relay GraphQL Cursor Connections +Specification](https://relay.dev/graphql/connections.htm#sec-Connection-Types) for more info. +""" +type InspectionNoteAggregationConnection { + """ + Wraps a specific `InspectionNoteAggregation` to pair it with its pagination cursor. + """ + edges: [InspectionNoteAggregationEdge!]! + + """ + The list of `InspectionNoteAggregation` results. + """ + nodes: [InspectionNoteAggregation!]! + + """ + Provides pagination-related information. + """ + page_info: PageInfo! +} + +""" +Represents a specific `InspectionNoteAggregation` in the context of a `InspectionNoteAggregationConnection`, +providing access to both the `InspectionNoteAggregation` and query-specific information such as the pagination `Cursor`. + +See the [Relay GraphQL Cursor Connections +Specification](https://relay.dev/graphql/connections.htm#sec-Edge-Types) for more info. +""" +type InspectionNoteAggregationEdge { + """ + The `Cursor` of this `InspectionNoteAggregation`. This can be passed in the next query as + a `before` or `after` argument to continue paginating from this `InspectionNoteAggregation`. + """ + cursor: Cursor + + """ + The `InspectionNoteAggregation` of this edge. + """ + node: InspectionNoteAggregation +} + +""" +Represents a paginated collection of `InspectionNote` results. + +See the [Relay GraphQL Cursor Connections +Specification](https://relay.dev/graphql/connections.htm#sec-Connection-Types) for more info. +""" +type InspectionNoteConnection { + """ + Wraps a specific `InspectionNote` to pair it with its pagination cursor. + """ + edges: [InspectionNoteEdge!]! + + """ + The list of `InspectionNote` results. + """ + nodes: [InspectionNote!]! + + """ + Provides pagination-related information. + """ + page_info: PageInfo! + + """ + The total number of edges available in this connection to paginate over. + """ + total_edge_count: JsonSafeLong! +} + +""" +Represents a specific `InspectionNote` in the context of a `InspectionNoteConnection`, +providing access to both the `InspectionNote` and query-specific information such as the pagination `Cursor`. + +See the [Relay GraphQL Cursor Connections +Specification](https://relay.dev/graphql/connections.htm#sec-Edge-Types) for more info. +""" +type InspectionNoteEdge { + """ + All search highlights for this `InspectionNote`, indicating where in the indexed document the query matched. + """ + all_highlights: [SearchHighlight!]! + + """ + The `Cursor` of this `InspectionNote`. This can be passed in the next query as + a `before` or `after` argument to continue paginating from this `InspectionNote`. + """ + cursor: Cursor + + """ + Specific search highlights for this `InspectionNote`, providing matching snippets for the requested fields. + """ + highlights: InspectionNoteHighlights + + """ + The `InspectionNote` of this edge. + """ + node: InspectionNote +} + +""" +Input type used to specify filters on `InspectionNote` fields. + +Will match all documents if passed as an empty object (or as `null`). +""" +input InspectionNoteFilterInput { + """ + Matches records where all of the provided sub-filters evaluate to true. This works just like an AND operator in SQL. + + Note: multiple filters are automatically ANDed together. This is only needed when you have multiple filters that can't + be provided on a single `InspectionNoteFilterInput` input because of + collisions between key names. For example, if you want to AND multiple + OR'd sub-filters (the equivalent of (A OR B) AND (C OR D)), you could do all_of: [{any_of: [...]}, {any_of: [...]}]. + + When `null` or an empty list is passed, matches all documents. + """ + all_of: [InspectionNoteFilterInput!] + + """ + Matches records where any of the provided sub-filters evaluate to true. + This works just like an OR operator in SQL. + + When `null` is passed, matches all documents. + When an empty list is passed, this part of the filter matches no documents. + """ + any_of: [InspectionNoteFilterInput!] + + """ + Used to filter on the `created_at` field. + + When `null` or an empty object is passed, matches all documents. + """ + created_at: DateTimeFilterInput + + """ + Used to filter on the `id` field. + + When `null` or an empty object is passed, matches all documents. + """ + id: IDFilterInput + + """ + Matches records where the provided sub-filter evaluates to false. + This works just like a NOT operator in SQL. + + When `null` or an empty object is passed, matches no documents. + """ + not: InspectionNoteFilterInput + + """ + Used to filter on the `note` field. + + When `null` or an empty object is passed, matches all documents. + """ + note: StringFilterInput + + """ + Used to filter on the `widget_inspection_guid` field. + + When `null` or an empty object is passed, matches all documents. + """ + widget_inspection_guid: IDFilterInput +} + +""" +Type used to specify the `InspectionNote` fields to group by for aggregations. +""" +type InspectionNoteGroupedBy { + """ + Offers the different grouping options for the `created_at` value within this group. + """ + created_at: DateTimeGroupedBy + + """ + The `note` field value for this group. + """ + note: String + + """ + The `widget_inspection_guid` field value for this group. + """ + widget_inspection_guid: ID +} + +""" +Type used to request desired `InspectionNote` search highlight fields. +""" +type InspectionNoteHighlights { + """ + Search highlights for the `id`, providing snippets of the matching text. + """ + id: [String!]! + + """ + Search highlights for the `note`, providing snippets of the matching text. + """ + note: [String!]! + + """ + Search highlights for the `widget_inspection_guid`, providing snippets of the matching text. + """ + widget_inspection_guid: [String!]! +} + +""" +Enumerates the ways `InspectionNote`s can be sorted. +""" +enum InspectionNoteSortOrderInput { + """ + Sorts ascending by the `created_at` field. + """ + created_at_ASC + + """ + Sorts descending by the `created_at` field. + """ + created_at_DESC + + """ + Sorts ascending by the `id` field. + """ + id_ASC + + """ + Sorts descending by the `id` field. + """ + id_DESC + + """ + Sorts ascending by the `note` field. + """ + note_ASC + + """ + Sorts descending by the `note` field. + """ + note_DESC + + """ + Sorts ascending by the `widget_inspection_guid` field. + """ + widget_inspection_guid_ASC + + """ + Sorts descending by the `widget_inspection_guid` field. + """ + widget_inspection_guid_DESC +} + +type InspectionSummary @key(fields: "id") { + created_at: DateTime! + id: ID! + summary: String + widget_inspection_guid: ID! +} + +""" +Type used to perform aggregation computations on `InspectionSummary` fields. +""" +type InspectionSummaryAggregatedValues { + """ + Computed aggregate values for the `created_at` field. + """ + created_at: DateTimeAggregatedValues + + """ + Computed aggregate values for the `id` field. + """ + id: NonNumericAggregatedValues + + """ + Computed aggregate values for the `summary` field. + """ + summary: NonNumericAggregatedValues + + """ + Computed aggregate values for the `widget_inspection_guid` field. + """ + widget_inspection_guid: NonNumericAggregatedValues +} + +""" +Return type representing a bucket of `InspectionSummary` documents for an aggregations query. +""" +type InspectionSummaryAggregation { + """ + Provides computed aggregated values over all `InspectionSummary` documents in an aggregation bucket. + """ + aggregated_values: InspectionSummaryAggregatedValues + + """ + The count of `InspectionSummary` documents in an aggregation bucket. + """ + count: JsonSafeLong! + + """ + Used to specify the `InspectionSummary` fields to group by. The returned values identify each aggregation bucket. + """ + grouped_by: InspectionSummaryGroupedBy +} + +""" +Represents a paginated collection of `InspectionSummaryAggregation` results. + +See the [Relay GraphQL Cursor Connections +Specification](https://relay.dev/graphql/connections.htm#sec-Connection-Types) for more info. +""" +type InspectionSummaryAggregationConnection { + """ + Wraps a specific `InspectionSummaryAggregation` to pair it with its pagination cursor. + """ + edges: [InspectionSummaryAggregationEdge!]! + + """ + The list of `InspectionSummaryAggregation` results. + """ + nodes: [InspectionSummaryAggregation!]! + + """ + Provides pagination-related information. + """ + page_info: PageInfo! +} + +""" +Represents a specific `InspectionSummaryAggregation` in the context of a `InspectionSummaryAggregationConnection`, +providing access to both the `InspectionSummaryAggregation` and query-specific information such as the pagination `Cursor`. + +See the [Relay GraphQL Cursor Connections +Specification](https://relay.dev/graphql/connections.htm#sec-Edge-Types) for more info. +""" +type InspectionSummaryAggregationEdge { + """ + The `Cursor` of this `InspectionSummaryAggregation`. This can be passed in the next query as + a `before` or `after` argument to continue paginating from this `InspectionSummaryAggregation`. + """ + cursor: Cursor + + """ + The `InspectionSummaryAggregation` of this edge. + """ + node: InspectionSummaryAggregation +} + +""" +Represents a paginated collection of `InspectionSummary` results. + +See the [Relay GraphQL Cursor Connections +Specification](https://relay.dev/graphql/connections.htm#sec-Connection-Types) for more info. +""" +type InspectionSummaryConnection { + """ + Wraps a specific `InspectionSummary` to pair it with its pagination cursor. + """ + edges: [InspectionSummaryEdge!]! + + """ + The list of `InspectionSummary` results. + """ + nodes: [InspectionSummary!]! + + """ + Provides pagination-related information. + """ + page_info: PageInfo! + + """ + The total number of edges available in this connection to paginate over. + """ + total_edge_count: JsonSafeLong! +} + +""" +Represents a specific `InspectionSummary` in the context of a `InspectionSummaryConnection`, +providing access to both the `InspectionSummary` and query-specific information such as the pagination `Cursor`. + +See the [Relay GraphQL Cursor Connections +Specification](https://relay.dev/graphql/connections.htm#sec-Edge-Types) for more info. +""" +type InspectionSummaryEdge { + """ + All search highlights for this `InspectionSummary`, indicating where in the indexed document the query matched. + """ + all_highlights: [SearchHighlight!]! + + """ + The `Cursor` of this `InspectionSummary`. This can be passed in the next query as + a `before` or `after` argument to continue paginating from this `InspectionSummary`. + """ + cursor: Cursor + + """ + Specific search highlights for this `InspectionSummary`, providing matching snippets for the requested fields. + """ + highlights: InspectionSummaryHighlights + + """ + The `InspectionSummary` of this edge. + """ + node: InspectionSummary +} + +""" +Input type used to specify filters on `InspectionSummary` fields. + +Will match all documents if passed as an empty object (or as `null`). +""" +input InspectionSummaryFilterInput { + """ + Matches records where all of the provided sub-filters evaluate to true. This works just like an AND operator in SQL. + + Note: multiple filters are automatically ANDed together. This is only needed when you have multiple filters that can't + be provided on a single `InspectionSummaryFilterInput` input because of + collisions between key names. For example, if you want to AND multiple + OR'd sub-filters (the equivalent of (A OR B) AND (C OR D)), you could do all_of: [{any_of: [...]}, {any_of: [...]}]. + + When `null` or an empty list is passed, matches all documents. + """ + all_of: [InspectionSummaryFilterInput!] + + """ + Matches records where any of the provided sub-filters evaluate to true. + This works just like an OR operator in SQL. + + When `null` is passed, matches all documents. + When an empty list is passed, this part of the filter matches no documents. + """ + any_of: [InspectionSummaryFilterInput!] + + """ + Used to filter on the `created_at` field. + + When `null` or an empty object is passed, matches all documents. + """ + created_at: DateTimeFilterInput + + """ + Used to filter on the `id` field. + + When `null` or an empty object is passed, matches all documents. + """ + id: IDFilterInput + + """ + Matches records where the provided sub-filter evaluates to false. + This works just like a NOT operator in SQL. + + When `null` or an empty object is passed, matches no documents. + """ + not: InspectionSummaryFilterInput + + """ + Used to filter on the `summary` field. + + When `null` or an empty object is passed, matches all documents. + """ + summary: StringFilterInput + + """ + Used to filter on the `widget_inspection_guid` field. + + When `null` or an empty object is passed, matches all documents. + """ + widget_inspection_guid: IDFilterInput +} + +""" +Type used to specify the `InspectionSummary` fields to group by for aggregations. +""" +type InspectionSummaryGroupedBy { + """ + Offers the different grouping options for the `created_at` value within this group. + """ + created_at: DateTimeGroupedBy + + """ + The `summary` field value for this group. + """ + summary: String + + """ + The `widget_inspection_guid` field value for this group. + """ + widget_inspection_guid: ID +} + +""" +Type used to request desired `InspectionSummary` search highlight fields. +""" +type InspectionSummaryHighlights { + """ + Search highlights for the `id`, providing snippets of the matching text. + """ + id: [String!]! + + """ + Search highlights for the `summary`, providing snippets of the matching text. + """ + summary: [String!]! + + """ + Search highlights for the `widget_inspection_guid`, providing snippets of the matching text. + """ + widget_inspection_guid: [String!]! +} + +""" +Enumerates the ways `InspectionSummary`s can be sorted. +""" +enum InspectionSummarySortOrderInput { + """ + Sorts ascending by the `created_at` field. + """ + created_at_ASC + + """ + Sorts descending by the `created_at` field. + """ + created_at_DESC + + """ + Sorts ascending by the `id` field. + """ + id_ASC + + """ + Sorts descending by the `id` field. + """ + id_DESC + + """ + Sorts ascending by the `summary` field. + """ + summary_ASC + + """ + Sorts descending by the `summary` field. + """ + summary_DESC + + """ + Sorts ascending by the `widget_inspection_guid` field. + """ + widget_inspection_guid_ASC + + """ + Sorts descending by the `widget_inspection_guid` field. + """ + widget_inspection_guid_DESC +} + """ A return type used from aggregations to provided aggregated values over `Int` fields. """ @@ -6295,6 +6899,11 @@ type NamedEntityAggregatedValues { """ id: NonNumericAggregatedValues + """ + Computed aggregate values for the `inspection` field. + """ + inspection: WidgetInspectionAggregatedValues + """ Computed aggregate values for the `internal_details` field. """ @@ -6701,6 +7310,13 @@ input NamedEntityFilterInput { """ id: IDFilterInput + """ + Used to filter on the `inspection` field. + + When `null` or an empty object is passed, matches all documents. + """ + inspection: WidgetInspectionFilterInput + """ Used to filter on the `internal_details` field. @@ -6980,6 +7596,11 @@ type NamedEntityGroupedBy { """ fees: MoneyGroupedBy + """ + The `inspection` field value for this group. + """ + inspection: WidgetInspectionGroupedBy + """ The `internal_details` field value for this group. """ @@ -7174,6 +7795,11 @@ type NamedEntityHighlights { """ id: [String!]! + """ + Search highlights for the `inspection`, providing snippets of the matching text. + """ + inspection: WidgetInspectionHighlights + """ Search highlights for the `internal_highlightable_details`, providing snippets of the matching text. """ @@ -7444,6 +8070,16 @@ enum NamedEntitySortOrderInput { """ id_DESC + """ + Sorts ascending by the `inspection.guid` field. + """ + inspection_guid_ASC + + """ + Sorts descending by the `inspection.guid` field. + """ + inspection_guid_DESC + """ Sorts ascending by the `internal_details.name` field. """ @@ -9687,14 +10323,220 @@ type Query { Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. """ last: Int - ): ComponentAggregationConnection + ): ComponentAggregationConnection + + """ + Fetches `Component`s based on the provided arguments. + """ + components( + """ + Used to forward-paginate through the `components`. When provided, the next page after the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + after: Cursor + + """ + Used to backward-paginate through the `components`. When provided, the previous page before the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + before: Cursor + + """ + Used to filter the returned `components` based on the provided criteria. + """ + filter: ComponentFilterInput + + """ + Used in conjunction with the `after` argument to forward-paginate through the `components`. + When provided, limits the number of returned results to the first `n` after the provided + `after` cursor (or from the start of the `components`, if no `after` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + first: Int + + """ + Used in conjunction with the `before` argument to backward-paginate through the `components`. + When provided, limits the number of returned results to the last `n` before the provided + `before` cursor (or from the end of the `components`, if no `before` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + last: Int + + """ + Used to specify how the returned `components` should be sorted. + """ + order_by: [ComponentSortOrderInput!] + ): ComponentConnection + + """ + Aggregations over the `distribution_channels` data: + + > Fetches `DistributionChannel`s based on the provided arguments. + """ + distribution_channel_aggregations( + """ + Used to forward-paginate through the `distribution_channel_aggregations`. When provided, the next page after the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + after: Cursor + + """ + Used to backward-paginate through the `distribution_channel_aggregations`. When provided, the previous page before the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + before: Cursor + + """ + Used to filter the `DistributionChannel` documents that get aggregated over based on the provided criteria. + """ + filter: DistributionChannelFilterInput + + """ + Used in conjunction with the `after` argument to forward-paginate through the `distribution_channel_aggregations`. + When provided, limits the number of returned results to the first `n` after the provided + `after` cursor (or from the start of the `distribution_channel_aggregations`, if no `after` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + first: Int + + """ + Used in conjunction with the `before` argument to backward-paginate through the `distribution_channel_aggregations`. + When provided, limits the number of returned results to the last `n` before the provided + `before` cursor (or from the end of the `distribution_channel_aggregations`, if no `before` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + last: Int + ): DistributionChannelAggregationConnection + + """ + Fetches `DistributionChannel`s based on the provided arguments. + """ + distribution_channels( + """ + Used to forward-paginate through the `distribution_channels`. When provided, the next page after the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + after: Cursor + + """ + Used to backward-paginate through the `distribution_channels`. When provided, the previous page before the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + before: Cursor + + """ + Used to filter the returned `distribution_channels` based on the provided criteria. + """ + filter: DistributionChannelFilterInput + + """ + Used in conjunction with the `after` argument to forward-paginate through the `distribution_channels`. + When provided, limits the number of returned results to the first `n` after the provided + `after` cursor (or from the start of the `distribution_channels`, if no `after` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + first: Int + + """ + Used in conjunction with the `before` argument to backward-paginate through the `distribution_channels`. + When provided, limits the number of returned results to the last `n` before the provided + `before` cursor (or from the end of the `distribution_channels`, if no `before` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + last: Int + + """ + Used to specify how the returned `distribution_channels` should be sorted. + """ + order_by: [DistributionChannelSortOrderInput!] + ): DistributionChannelConnection + + """ + Aggregations over the `electrical_parts` data: + + > Fetches `ElectricalPart`s based on the provided arguments. + """ + electrical_part_aggregations( + """ + Used to forward-paginate through the `electrical_part_aggregations`. When provided, the next page after the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + after: Cursor + + """ + Used to backward-paginate through the `electrical_part_aggregations`. When provided, the previous page before the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + before: Cursor + + """ + Used to filter the `ElectricalPart` documents that get aggregated over based on the provided criteria. + """ + filter: ElectricalPartFilterInput + + """ + Used in conjunction with the `after` argument to forward-paginate through the `electrical_part_aggregations`. + When provided, limits the number of returned results to the first `n` after the provided + `after` cursor (or from the start of the `electrical_part_aggregations`, if no `after` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + first: Int + + """ + Used in conjunction with the `before` argument to backward-paginate through the `electrical_part_aggregations`. + When provided, limits the number of returned results to the last `n` before the provided + `before` cursor (or from the end of the `electrical_part_aggregations`, if no `before` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + last: Int + ): ElectricalPartAggregationConnection """ - Fetches `Component`s based on the provided arguments. + Fetches `ElectricalPart`s based on the provided arguments. """ - components( + electrical_parts( """ - Used to forward-paginate through the `components`. When provided, the next page after the + Used to forward-paginate through the `electrical_parts`. When provided, the next page after the provided cursor will be returned. See the [Relay GraphQL Cursor Connections @@ -9703,7 +10545,7 @@ type Query { after: Cursor """ - Used to backward-paginate through the `components`. When provided, the previous page before the + Used to backward-paginate through the `electrical_parts`. When provided, the previous page before the provided cursor will be returned. See the [Relay GraphQL Cursor Connections @@ -9712,14 +10554,14 @@ type Query { before: Cursor """ - Used to filter the returned `components` based on the provided criteria. + Used to filter the returned `electrical_parts` based on the provided criteria. """ - filter: ComponentFilterInput + filter: ElectricalPartFilterInput """ - Used in conjunction with the `after` argument to forward-paginate through the `components`. + Used in conjunction with the `after` argument to forward-paginate through the `electrical_parts`. When provided, limits the number of returned results to the first `n` after the provided - `after` cursor (or from the start of the `components`, if no `after` cursor is provided). + `after` cursor (or from the start of the `electrical_parts`, if no `after` cursor is provided). See the [Relay GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. @@ -9727,9 +10569,9 @@ type Query { first: Int """ - Used in conjunction with the `before` argument to backward-paginate through the `components`. + Used in conjunction with the `before` argument to backward-paginate through the `electrical_parts`. When provided, limits the number of returned results to the last `n` before the provided - `before` cursor (or from the end of the `components`, if no `before` cursor is provided). + `before` cursor (or from the end of the `electrical_parts`, if no `before` cursor is provided). See the [Relay GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. @@ -9737,19 +10579,19 @@ type Query { last: Int """ - Used to specify how the returned `components` should be sorted. + Used to specify how the returned `electrical_parts` should be sorted. """ - order_by: [ComponentSortOrderInput!] - ): ComponentConnection + order_by: [ElectricalPartSortOrderInput!] + ): ElectricalPartConnection """ - Aggregations over the `distribution_channels` data: + Aggregations over the `inspection_notes` data: - > Fetches `DistributionChannel`s based on the provided arguments. + > Fetches `InspectionNote`s based on the provided arguments. """ - distribution_channel_aggregations( + inspection_note_aggregations( """ - Used to forward-paginate through the `distribution_channel_aggregations`. When provided, the next page after the + Used to forward-paginate through the `inspection_note_aggregations`. When provided, the next page after the provided cursor will be returned. See the [Relay GraphQL Cursor Connections @@ -9758,7 +10600,7 @@ type Query { after: Cursor """ - Used to backward-paginate through the `distribution_channel_aggregations`. When provided, the previous page before the + Used to backward-paginate through the `inspection_note_aggregations`. When provided, the previous page before the provided cursor will be returned. See the [Relay GraphQL Cursor Connections @@ -9767,14 +10609,14 @@ type Query { before: Cursor """ - Used to filter the `DistributionChannel` documents that get aggregated over based on the provided criteria. + Used to filter the `InspectionNote` documents that get aggregated over based on the provided criteria. """ - filter: DistributionChannelFilterInput + filter: InspectionNoteFilterInput """ - Used in conjunction with the `after` argument to forward-paginate through the `distribution_channel_aggregations`. + Used in conjunction with the `after` argument to forward-paginate through the `inspection_note_aggregations`. When provided, limits the number of returned results to the first `n` after the provided - `after` cursor (or from the start of the `distribution_channel_aggregations`, if no `after` cursor is provided). + `after` cursor (or from the start of the `inspection_note_aggregations`, if no `after` cursor is provided). See the [Relay GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. @@ -9782,22 +10624,22 @@ type Query { first: Int """ - Used in conjunction with the `before` argument to backward-paginate through the `distribution_channel_aggregations`. + Used in conjunction with the `before` argument to backward-paginate through the `inspection_note_aggregations`. When provided, limits the number of returned results to the last `n` before the provided - `before` cursor (or from the end of the `distribution_channel_aggregations`, if no `before` cursor is provided). + `before` cursor (or from the end of the `inspection_note_aggregations`, if no `before` cursor is provided). See the [Relay GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. """ last: Int - ): DistributionChannelAggregationConnection + ): InspectionNoteAggregationConnection """ - Fetches `DistributionChannel`s based on the provided arguments. + Fetches `InspectionNote`s based on the provided arguments. """ - distribution_channels( + inspection_notes( """ - Used to forward-paginate through the `distribution_channels`. When provided, the next page after the + Used to forward-paginate through the `inspection_notes`. When provided, the next page after the provided cursor will be returned. See the [Relay GraphQL Cursor Connections @@ -9806,7 +10648,7 @@ type Query { after: Cursor """ - Used to backward-paginate through the `distribution_channels`. When provided, the previous page before the + Used to backward-paginate through the `inspection_notes`. When provided, the previous page before the provided cursor will be returned. See the [Relay GraphQL Cursor Connections @@ -9815,14 +10657,14 @@ type Query { before: Cursor """ - Used to filter the returned `distribution_channels` based on the provided criteria. + Used to filter the returned `inspection_notes` based on the provided criteria. """ - filter: DistributionChannelFilterInput + filter: InspectionNoteFilterInput """ - Used in conjunction with the `after` argument to forward-paginate through the `distribution_channels`. + Used in conjunction with the `after` argument to forward-paginate through the `inspection_notes`. When provided, limits the number of returned results to the first `n` after the provided - `after` cursor (or from the start of the `distribution_channels`, if no `after` cursor is provided). + `after` cursor (or from the start of the `inspection_notes`, if no `after` cursor is provided). See the [Relay GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. @@ -9830,9 +10672,9 @@ type Query { first: Int """ - Used in conjunction with the `before` argument to backward-paginate through the `distribution_channels`. + Used in conjunction with the `before` argument to backward-paginate through the `inspection_notes`. When provided, limits the number of returned results to the last `n` before the provided - `before` cursor (or from the end of the `distribution_channels`, if no `before` cursor is provided). + `before` cursor (or from the end of the `inspection_notes`, if no `before` cursor is provided). See the [Relay GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. @@ -9840,19 +10682,17 @@ type Query { last: Int """ - Used to specify how the returned `distribution_channels` should be sorted. + Used to specify how the returned `inspection_notes` should be sorted. """ - order_by: [DistributionChannelSortOrderInput!] - ): DistributionChannelConnection + order_by: [InspectionNoteSortOrderInput!] + ): InspectionNoteConnection """ - Aggregations over the `electrical_parts` data: - - > Fetches `ElectricalPart`s based on the provided arguments. + Fetches `InspectionSummary`s based on the provided arguments. """ - electrical_part_aggregations( + inspection_summaries( """ - Used to forward-paginate through the `electrical_part_aggregations`. When provided, the next page after the + Used to forward-paginate through the `inspection_summaries`. When provided, the next page after the provided cursor will be returned. See the [Relay GraphQL Cursor Connections @@ -9861,7 +10701,7 @@ type Query { after: Cursor """ - Used to backward-paginate through the `electrical_part_aggregations`. When provided, the previous page before the + Used to backward-paginate through the `inspection_summaries`. When provided, the previous page before the provided cursor will be returned. See the [Relay GraphQL Cursor Connections @@ -9870,14 +10710,14 @@ type Query { before: Cursor """ - Used to filter the `ElectricalPart` documents that get aggregated over based on the provided criteria. + Used to filter the returned `inspection_summaries` based on the provided criteria. """ - filter: ElectricalPartFilterInput + filter: InspectionSummaryFilterInput """ - Used in conjunction with the `after` argument to forward-paginate through the `electrical_part_aggregations`. + Used in conjunction with the `after` argument to forward-paginate through the `inspection_summaries`. When provided, limits the number of returned results to the first `n` after the provided - `after` cursor (or from the start of the `electrical_part_aggregations`, if no `after` cursor is provided). + `after` cursor (or from the start of the `inspection_summaries`, if no `after` cursor is provided). See the [Relay GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. @@ -9885,22 +10725,29 @@ type Query { first: Int """ - Used in conjunction with the `before` argument to backward-paginate through the `electrical_part_aggregations`. + Used in conjunction with the `before` argument to backward-paginate through the `inspection_summaries`. When provided, limits the number of returned results to the last `n` before the provided - `before` cursor (or from the end of the `electrical_part_aggregations`, if no `before` cursor is provided). + `before` cursor (or from the end of the `inspection_summaries`, if no `before` cursor is provided). See the [Relay GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. """ last: Int - ): ElectricalPartAggregationConnection + + """ + Used to specify how the returned `inspection_summaries` should be sorted. + """ + order_by: [InspectionSummarySortOrderInput!] + ): InspectionSummaryConnection """ - Fetches `ElectricalPart`s based on the provided arguments. + Aggregations over the `inspection_summaries` data: + + > Fetches `InspectionSummary`s based on the provided arguments. """ - electrical_parts( + inspection_summary_aggregations( """ - Used to forward-paginate through the `electrical_parts`. When provided, the next page after the + Used to forward-paginate through the `inspection_summary_aggregations`. When provided, the next page after the provided cursor will be returned. See the [Relay GraphQL Cursor Connections @@ -9909,7 +10756,7 @@ type Query { after: Cursor """ - Used to backward-paginate through the `electrical_parts`. When provided, the previous page before the + Used to backward-paginate through the `inspection_summary_aggregations`. When provided, the previous page before the provided cursor will be returned. See the [Relay GraphQL Cursor Connections @@ -9918,14 +10765,14 @@ type Query { before: Cursor """ - Used to filter the returned `electrical_parts` based on the provided criteria. + Used to filter the `InspectionSummary` documents that get aggregated over based on the provided criteria. """ - filter: ElectricalPartFilterInput + filter: InspectionSummaryFilterInput """ - Used in conjunction with the `after` argument to forward-paginate through the `electrical_parts`. + Used in conjunction with the `after` argument to forward-paginate through the `inspection_summary_aggregations`. When provided, limits the number of returned results to the first `n` after the provided - `after` cursor (or from the start of the `electrical_parts`, if no `after` cursor is provided). + `after` cursor (or from the start of the `inspection_summary_aggregations`, if no `after` cursor is provided). See the [Relay GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. @@ -9933,20 +10780,15 @@ type Query { first: Int """ - Used in conjunction with the `before` argument to backward-paginate through the `electrical_parts`. + Used in conjunction with the `before` argument to backward-paginate through the `inspection_summary_aggregations`. When provided, limits the number of returned results to the last `n` before the provided - `before` cursor (or from the end of the `electrical_parts`, if no `before` cursor is provided). + `before` cursor (or from the end of the `inspection_summary_aggregations`, if no `before` cursor is provided). See the [Relay GraphQL Cursor Connections Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. """ last: Int - - """ - Used to specify how the returned `electrical_parts` should be sorted. - """ - order_by: [ElectricalPartSortOrderInput!] - ): ElectricalPartConnection + ): InspectionSummaryAggregationConnection """ Aggregations over the `inventors` data: @@ -15971,6 +16813,7 @@ type Widget implements NamedEntity @key(fields: "id") { description: String fees: [Money!]! id: ID! + inspection: WidgetInspection inventor: Inventor metadata: Untyped name: String @@ -16067,6 +16910,11 @@ type WidgetAggregatedValues { """ id: NonNumericAggregatedValues + """ + Computed aggregate values for the `inspection` field. + """ + inspection: WidgetInspectionAggregatedValues + """ Computed aggregate values for the `internal_details` field. """ @@ -17038,6 +17886,13 @@ input WidgetFilterInput { """ id: IDFilterInput + """ + Used to filter on the `inspection` field. + + When `null` or an empty object is passed, matches all documents. + """ + inspection: WidgetInspectionFilterInput + """ Used to filter on the `internal_details` field. @@ -17256,6 +18111,11 @@ type WidgetGroupedBy { """ fees: MoneyGroupedBy + """ + The `inspection` field value for this group. + """ + inspection: WidgetInspectionGroupedBy + """ The `internal_details` field value for this group. """ @@ -17410,6 +18270,11 @@ type WidgetHighlights { """ id: [String!]! + """ + Search highlights for the `inspection`, providing snippets of the matching text. + """ + inspection: WidgetInspectionHighlights + """ Search highlights for the `internal_highlightable_details`, providing snippets of the matching text. """ @@ -17476,6 +18341,181 @@ type WidgetHighlights { workspace_name: [String!]! } +type WidgetInspection { + guid: ID! + + """ + Aggregations over the `inspection_notes` data. + """ + inspection_note_aggregations( + """ + Used to forward-paginate through the `inspection_note_aggregations`. When provided, the next page after the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + after: Cursor + + """ + Used to backward-paginate through the `inspection_note_aggregations`. When provided, the previous page before the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + before: Cursor + + """ + Used to filter the `InspectionNote` documents that get aggregated over based on the provided criteria. + """ + filter: InspectionNoteFilterInput + + """ + Used in conjunction with the `after` argument to forward-paginate through the `inspection_note_aggregations`. + When provided, limits the number of returned results to the first `n` after the provided + `after` cursor (or from the start of the `inspection_note_aggregations`, if no `after` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + first: Int + + """ + Used in conjunction with the `before` argument to backward-paginate through the `inspection_note_aggregations`. + When provided, limits the number of returned results to the last `n` before the provided + `before` cursor (or from the end of the `inspection_note_aggregations`, if no `before` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + last: Int + ): InspectionNoteAggregationConnection + inspection_notes( + """ + Used to forward-paginate through the `inspection_notes`. When provided, the next page after the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + after: Cursor + + """ + Used to backward-paginate through the `inspection_notes`. When provided, the previous page before the + provided cursor will be returned. + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + before: Cursor + + """ + Used to filter the returned `inspection_notes` based on the provided criteria. + """ + filter: InspectionNoteFilterInput + + """ + Used in conjunction with the `after` argument to forward-paginate through the `inspection_notes`. + When provided, limits the number of returned results to the first `n` after the provided + `after` cursor (or from the start of the `inspection_notes`, if no `after` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + first: Int + + """ + Used in conjunction with the `before` argument to backward-paginate through the `inspection_notes`. + When provided, limits the number of returned results to the last `n` before the provided + `before` cursor (or from the end of the `inspection_notes`, if no `before` cursor is provided). + + See the [Relay GraphQL Cursor Connections + Specification](https://relay.dev/graphql/connections.htm#sec-Arguments) for more info. + """ + last: Int + + """ + Used to specify how the returned `inspection_notes` should be sorted. + """ + order_by: [InspectionNoteSortOrderInput!] + ): InspectionNoteConnection + inspection_summary: InspectionSummary +} + +""" +Type used to perform aggregation computations on `WidgetInspection` fields. +""" +type WidgetInspectionAggregatedValues { + """ + Computed aggregate values for the `guid` field. + """ + guid: NonNumericAggregatedValues +} + +""" +Input type used to specify filters on `WidgetInspection` fields. + +Will match all documents if passed as an empty object (or as `null`). +""" +input WidgetInspectionFilterInput { + """ + Matches records where all of the provided sub-filters evaluate to true. This works just like an AND operator in SQL. + + Note: multiple filters are automatically ANDed together. This is only needed when you have multiple filters that can't + be provided on a single `WidgetInspectionFilterInput` input because of + collisions between key names. For example, if you want to AND multiple + OR'd sub-filters (the equivalent of (A OR B) AND (C OR D)), you could do all_of: [{any_of: [...]}, {any_of: [...]}]. + + When `null` or an empty list is passed, matches all documents. + """ + all_of: [WidgetInspectionFilterInput!] + + """ + Matches records where any of the provided sub-filters evaluate to true. + This works just like an OR operator in SQL. + + When `null` is passed, matches all documents. + When an empty list is passed, this part of the filter matches no documents. + """ + any_of: [WidgetInspectionFilterInput!] + + """ + Used to filter on the `guid` field. + + When `null` or an empty object is passed, matches all documents. + """ + guid: IDFilterInput + + """ + Matches records where the provided sub-filter evaluates to false. + This works just like a NOT operator in SQL. + + When `null` or an empty object is passed, matches no documents. + """ + not: WidgetInspectionFilterInput +} + +""" +Type used to specify the `WidgetInspection` fields to group by for aggregations. +""" +type WidgetInspectionGroupedBy { + """ + The `guid` field value for this group. + """ + guid: ID +} + +""" +Type used to request desired `WidgetInspection` search highlight fields. +""" +type WidgetInspectionHighlights { + """ + Search highlights for the `guid`, providing snippets of the matching text. + """ + guid: [String!]! +} + """ Type used to perform aggregation computations on `WidgetInternalDetails` fields. """ @@ -17866,6 +18906,11 @@ type WidgetOrAddressAggregatedValues { """ id: NonNumericAggregatedValues + """ + Computed aggregate values for the `inspection` field. + """ + inspection: WidgetInspectionAggregatedValues + """ Computed aggregate values for the `internal_details` field. """ @@ -18249,6 +19294,13 @@ input WidgetOrAddressFilterInput { """ id: IDFilterInput + """ + Used to filter on the `inspection` field. + + When `null` or an empty object is passed, matches all documents. + """ + inspection: WidgetInspectionFilterInput + """ Used to filter on the `internal_details` field. @@ -18479,6 +19531,11 @@ type WidgetOrAddressGroupedBy { """ full_address: String + """ + The `inspection` field value for this group. + """ + inspection: WidgetInspectionGroupedBy + """ The `internal_details` field value for this group. """ @@ -18643,6 +19700,11 @@ type WidgetOrAddressHighlights { """ id: [String!]! + """ + Search highlights for the `inspection`, providing snippets of the matching text. + """ + inspection: WidgetInspectionHighlights + """ Search highlights for the `internal_highlightable_details`, providing snippets of the matching text. """ @@ -18863,6 +19925,16 @@ enum WidgetOrAddressSortOrderInput { """ id_DESC + """ + Sorts ascending by the `inspection.guid` field. + """ + inspection_guid_ASC + + """ + Sorts descending by the `inspection.guid` field. + """ + inspection_guid_DESC + """ Sorts ascending by the `internal_details.name` field. """ @@ -19268,6 +20340,16 @@ enum WidgetSortOrderInput { """ id_DESC + """ + Sorts ascending by the `inspection.guid` field. + """ + inspection_guid_ASC + + """ + Sorts descending by the `inspection.guid` field. + """ + inspection_guid_DESC + """ Sorts ascending by the `internal_details.name` field. """ @@ -19935,7 +21017,7 @@ In an ElasticGraph schema, this is a union of all indexed types. Not intended for use by clients other than Apollo. """ -union _Entity = BrokerWholesaler | Company | Component | Country | DirectWholesaler | ElectricalPart | Manufacturer | MechanicalPart | OnlineStore | Person | PhysicalStore | Sponsor | Team | Widget | WidgetCurrency | WidgetWorkspace +union _Entity = BrokerWholesaler | Company | Component | Country | DirectWholesaler | ElectricalPart | InspectionNote | InspectionSummary | Manufacturer | MechanicalPart | OnlineStore | Person | PhysicalStore | Sponsor | Team | Widget | WidgetCurrency | WidgetWorkspace """ An object type required by the [Apollo Federation subgraph diff --git a/config/schema/widgets.rb b/config/schema/widgets.rb index 490f85408..f7eff4833 100644 --- a/config/schema/widgets.rb +++ b/config/schema/widgets.rb @@ -82,6 +82,37 @@ t.field "y", "Float!" end + schema.object_type "WidgetInspection" do |t| + t.field "guid", "ID!" + + t.relates_to_one "inspection_summary", "InspectionSummary", via: "widget_inspection_guid", references: "guid", dir: :in + t.relates_to_many "inspection_notes", "InspectionNote", via: "widget_inspection_guid", references: "guid", dir: :in, singular: "inspection_note" + end + + schema.object_type "InspectionSummary" do |t| + t.root_query_fields plural: "inspection_summaries" + t.field "id", "ID!" + t.field "widget_inspection_guid", "ID!" + t.field "summary", "String" + t.field "created_at", "DateTime!" + + t.index "inspection_summaries" do |i| + i.default_sort "created_at", :desc + end + end + + schema.object_type "InspectionNote" do |t| + t.root_query_fields plural: "inspection_notes" + t.field "id", "ID!" + t.field "widget_inspection_guid", "ID!" + t.field "note", "String" + t.field "created_at", "DateTime!" + + t.index "inspection_notes" do |i| + i.default_sort "created_at", :desc + end + end + schema.object_type "Widget" do |t| t.root_query_fields plural: "widgets" t.implements "NamedEntity" @@ -154,6 +185,8 @@ f.sourced_from "workspace", "name" end + t.field "inspection", "WidgetInspection" + # Customize the index so we can demonstrate that index customization works. # Also, to demonstrate that custom shard routing works correctly, we need multiple shards. # That way, our documents wind up on multiple shards and we can demonstrate that our diff --git a/config/settings/test.yaml.template b/config/settings/test.yaml.template index 94ae2e2ca..e97f8e533 100644 --- a/config/settings/test.yaml.template +++ b/config/settings/test.yaml.template @@ -36,6 +36,8 @@ datastore: setting_overrides_by_timestamp: {} components: *main_index_settings electrical_parts: *main_index_settings + inspection_notes: *main_index_settings + inspection_summaries: *main_index_settings named_inventors: *main_index_settings manufacturers: *main_index_settings mechanical_parts: *main_index_settings diff --git a/elasticgraph-graphql/spec/acceptance/hidden_types_spec.rb b/elasticgraph-graphql/spec/acceptance/hidden_types_spec.rb index e25c611df..5a150affb 100644 --- a/elasticgraph-graphql/spec/acceptance/hidden_types_spec.rb +++ b/elasticgraph-graphql/spec/acceptance/hidden_types_spec.rb @@ -76,6 +76,8 @@ module ElasticGraph all_types_related_to("Part") + all_types_related_to("NamedEntity") + all_types_related_to("WidgetCurrency") + + all_types_related_to("InspectionSummary") + + all_types_related_to("InspectionNote") + all_types_related_to("Team") + all_types_related_to("Sponsor") + all_types_related_to("Inventor") + @@ -110,6 +112,7 @@ module ElasticGraph type_filter_and_non_indexed_aggregation_types_for("PlayerSeason", include_list_filter: true, include_fields_list_filter: true) - ["PlayerSeasonListElementFilterInput"] + type_filter_and_non_indexed_aggregation_types_for("TeamRecord", include_fields_list_filter: true, include_highlights: false) + type_filter_and_non_indexed_aggregation_types_for("TeamSeason", include_list_filter: true, include_fields_list_filter: true) - ["TeamSeasonListElementFilterInput"] + + type_filter_and_non_indexed_aggregation_types_for("WidgetInspection") + type_filter_and_non_indexed_aggregation_types_for("WidgetInternalDetails") - ["WidgetInternalDetails"] + type_filter_and_non_indexed_aggregation_types_for("WidgetOptions") + type_filter_and_non_indexed_aggregation_types_for("WidgetOptionSets") - ["WidgetOptionSetsGroupedBy"] + diff --git a/elasticgraph-graphql/spec/acceptance/nested_relationships_spec.rb b/elasticgraph-graphql/spec/acceptance/nested_relationships_spec.rb index e158c4c95..c1964e9b6 100644 --- a/elasticgraph-graphql/spec/acceptance/nested_relationships_spec.rb +++ b/elasticgraph-graphql/spec/acceptance/nested_relationships_spec.rb @@ -29,11 +29,25 @@ module ElasticGraph let(:component3) { build(:component, parts: [part2, part3], name: "comp3", created_at: "2019-06-02T00:00:00Z") } let(:component4) { build(:component, parts: [part2], name: "comp4", created_at: "2019-06-01T00:00:00Z") } - let(:widget1) { build(:widget, name: "widget1", amount_cents: 100, components: [component1, component2, component4], created_at: "2019-06-02T00:00:00Z") } - let(:widget2) { build(:widget, name: "widget2", amount_cents: 200, components: [component3], created_at: "2019-06-01T00:00:00Z") } + let(:inspection1) { build(:widget_inspection) } + let(:inspection2) { build(:widget_inspection) } + + let(:summary1) { build(:inspection_summary, widget_inspection: inspection1, summary: "summary1") } + let(:summary2) { build(:inspection_summary, widget_inspection: inspection2, summary: "summary2") } + + let(:note1_1) { build(:inspection_note, widget_inspection: inspection1, note: "note1_1") } + let(:note1_2) { build(:inspection_note, widget_inspection: inspection1, note: "note1_2") } + let(:note2_1) { build(:inspection_note, widget_inspection: inspection2, note: "note2_1") } + + let(:widget1) { build(:widget, name: "widget1", amount_cents: 100, components: [component1, component2, component4], inspection: inspection1, created_at: "2019-06-02T00:00:00Z") } + let(:widget2) { build(:widget, name: "widget2", amount_cents: 200, components: [component3], inspection: inspection2, created_at: "2019-06-01T00:00:00Z") } before do - index_records(manufacturer1, manufacturer2, address1, address2, part1, part2, part3, component1, component2, component3, component4, widget1, widget2) + index_records( + manufacturer1, manufacturer2, address1, address2, part1, part2, part3, + component1, component2, component3, component4, widget1, widget2, + summary1, summary2, note1_1, note1_2, note2_1 + ) end it "supports filtering relationships with additional filter conditions" do @@ -374,6 +388,61 @@ module ElasticGraph ) end + it "supports relationships from embedded types using custom `references` parameter" do + results = call_graphql_query(<<~QUERY).dig("data", "widgets", "nodes") + query { + widgets(filter: {name: {equal_to_any_of: ["widget1", "widget2"]}}, order_by: [name_ASC]) { + nodes { + name + inspection { + guid + inspection_summary { + summary + } + inspection_notes(order_by: [note_ASC]) { + nodes { + note + } + } + } + } + } + } + QUERY + + expect(results).to match([ + { + case_correctly("name") => "widget1", + case_correctly("inspection") => { + case_correctly("guid") => inspection1.fetch(:guid), + case_correctly("inspection_summary") => { + case_correctly("summary") => "summary1" + }, + case_correctly("inspection_notes") => { + case_correctly("nodes") => [ + {case_correctly("note") => "note1_1"}, + {case_correctly("note") => "note1_2"} + ] + } + } + }, + { + case_correctly("name") => "widget2", + case_correctly("inspection") => { + case_correctly("guid") => inspection2.fetch(:guid), + case_correctly("inspection_summary") => { + case_correctly("summary") => "summary2" + }, + case_correctly("inspection_notes") => { + case_correctly("nodes") => [ + {case_correctly("note") => "note2_1"} + ] + } + } + } + ]) + end + def case_correctly(string_or_sym) return super(string_or_sym.to_s).to_sym if string_or_sym.is_a?(Symbol) super diff --git a/spec_support/lib/elastic_graph/spec_support/factories/widgets.rb b/spec_support/lib/elastic_graph/spec_support/factories/widgets.rb index df0b6f379..3600efa33 100644 --- a/spec_support/lib/elastic_graph/spec_support/factories/widgets.rb +++ b/spec_support/lib/elastic_graph/spec_support/factories/widgets.rb @@ -89,6 +89,33 @@ created_at { Faker::Time.between(from: recent_date - 30, to: recent_date).utc.iso8601 } end + factory :widget_inspection, parent: :hash_base do + __typename { "WidgetInspection" } + guid { Faker::Alphanumeric.alpha(number: 20) } + end + + factory :inspection_summary, parent: :indexed_type do + __typename { "InspectionSummary" } + widget_inspection_guid { widget_inspection&.fetch(:guid) } + summary { Faker::Lorem.sentence } + created_at { Faker::Time.between(from: recent_date - 30, to: recent_date).utc.iso8601 } + + transient do + widget_inspection { nil } + end + end + + factory :inspection_note, parent: :indexed_type do + __typename { "InspectionNote" } + widget_inspection_guid { widget_inspection&.fetch(:guid) } + note { Faker::Lorem.sentence } + created_at { Faker::Time.between(from: recent_date - 30, to: recent_date).utc.iso8601 } + + transient do + widget_inspection { nil } + end + end + factory :widget, parent: :indexed_type do __typename { "Widget" } workspace_id { Faker::Alphanumeric.alpha(number: 6) } @@ -113,6 +140,7 @@ the_options { options } internal_details { build :widget_internal_details } internal_highlightable_details { build :widget_internal_details } + inspection { build :widget_inspection } component_ids do components.map { |c| c.fetch(:id) } From 177dfd1b387d828feec3eff5da2a97b075923ec9 Mon Sep 17 00:00:00 2001 From: ellisandrews-toast Date: Tue, 19 May 2026 21:03:15 -0400 Subject: [PATCH 5/6] Add comment --- config/schema/widgets.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/schema/widgets.rb b/config/schema/widgets.rb index f7eff4833..82a6e7ce6 100644 --- a/config/schema/widgets.rb +++ b/config/schema/widgets.rb @@ -82,6 +82,10 @@ t.field "y", "Float!" end + # WidgetInspection, InspectionSummary, and InspectionNote are used to test relationships from embedded types + # using the custom `references` parameter. WidgetInspection is an embedded type (no index) that uses `guid` + # as its identifier instead of `id`, demonstrating that the `references` parameter allows customizing which + # field on the embedded type is used for matching when resolving relationships to indexed types. schema.object_type "WidgetInspection" do |t| t.field "guid", "ID!" From 2d8e6b97b1db2aba1c8e9a4bdafc2360131498a1 Mon Sep 17 00:00:00 2001 From: ellisandrews-toast Date: Tue, 19 May 2026 21:23:54 -0400 Subject: [PATCH 6/6] Add inspection index definitions to development settings --- config/settings/development.yaml | 2 ++ config/settings/development_with_apollo.yaml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/config/settings/development.yaml b/config/settings/development.yaml index 2f2129e69..41e3dbee7 100644 --- a/config/settings/development.yaml +++ b/config/settings/development.yaml @@ -18,6 +18,8 @@ datastore: setting_overrides_by_timestamp: {} components: *main_index_settings electrical_parts: *main_index_settings + inspection_notes: *main_index_settings + inspection_summaries: *main_index_settings named_inventors: *main_index_settings manufacturers: *main_index_settings mechanical_parts: *main_index_settings diff --git a/config/settings/development_with_apollo.yaml b/config/settings/development_with_apollo.yaml index 9cb085d24..a1a7821a6 100644 --- a/config/settings/development_with_apollo.yaml +++ b/config/settings/development_with_apollo.yaml @@ -18,6 +18,8 @@ datastore: setting_overrides_by_timestamp: {} components: *main_index_settings electrical_parts: *main_index_settings + inspection_notes: *main_index_settings + inspection_summaries: *main_index_settings named_inventors: *main_index_settings manufacturers: *main_index_settings mechanical_parts: *main_index_settings