For example, if you apply this diff to the EG test schema and config:
diff --git a/config/schema/widgets.rb b/config/schema/widgets.rb
index 7df5223f..f24e9da1 100644
--- a/config/schema/widgets.rb
+++ b/config/schema/widgets.rb
@@ -296,36 +296,28 @@ ElasticGraph.define_schema do |schema|
schema.object_type "MechanicalPart" do |t|
t.root_query_fields plural: "mechanical_parts"
- t.implements "NamedEntity"
t.field "id", "ID!"
t.field "name", "String"
t.field "created_at", "DateTime!"
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.index "mechanical_parts" do |i|
- i.default_sort "created_at", :desc
- end
end
schema.object_type "ElectricalPart" do |t|
t.root_query_fields plural: "electrical_parts"
- t.implements "NamedEntity"
t.field "id", "ID!"
t.field "name", "String"
t.field "created_at", "DateTime!"
t.field "voltage", "Int!"
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.index "electrical_parts" do |i|
- i.default_sort "created_at", :desc
- end
end
schema.union_type "Part" do |t|
t.subtypes "MechanicalPart", "ElectricalPart"
+
+ t.index "parts"
end
# Note: `Manufacturer` is used in our tests as an example of an indexed type that has no list fields, so we should
diff --git a/config/settings/development.yaml b/config/settings/development.yaml
index cbc914cd..631a9233 100644
--- a/config/settings/development.yaml
+++ b/config/settings/development.yaml
@@ -17,9 +17,8 @@ datastore:
number_of_shards: 1
setting_overrides_by_timestamp: {}
components: *main_index_settings
- electrical_parts: *main_index_settings
manufacturers: *main_index_settings
- mechanical_parts: *main_index_settings
+ parts: *main_index_settings
teams: *main_index_settings
widget_currencies: *main_index_settings
widgets: *main_index_settings
...and then run bundle exec rake boot_locally, you get failures:
1) ElectricalPart:vzednoadoitbhjhwvbyb@v11: Malformed event payload. Validation errors:
{
"data_pointer": "/type",
"schema_pointer": "/$defs/ElasticGraphEventEnvelope/properties/type",
"type": "enum",
"error": "value at `/type` is not one of: [\"Address\", \"Component\", \"Manufacturer\", \"Sponsor\", \"Team\", \"Widget\", \"WidgetWorkspace\"]"
}
The problem is the affect it has on the JSON schema:
diff --git a/config/schema/artifacts/json_schemas.yaml b/config/schema/artifacts/json_schemas.yaml
index 8e37c372..b3ca929a 100644
--- a/config/schema/artifacts/json_schemas.yaml
+++ b/config/schema/artifacts/json_schemas.yaml
@@ -24,9 +24,7 @@ json_schema_version: 1
enum:
- Address
- Component
- - ElectricalPart
- Manufacturer
- - MechanicalPart
- Sponsor
- Team
- Widget
@@ -243,39 +241,6 @@ json_schema_version: 1
DateTime:
type: string
format: date-time
- ElectricalPart:
- type: object
- properties:
- id:
- allOf:
- - "$ref": "#/$defs/ID"
- - maxLength: 8191
- name:
- anyOf:
- - allOf:
- - "$ref": "#/$defs/String"
- - maxLength: 8191
- - type: 'null'
- created_at:
- "$ref": "#/$defs/DateTime"
- voltage:
- "$ref": "#/$defs/Int"
- manufacturer_id:
- anyOf:
- - allOf:
- - "$ref": "#/$defs/ID"
- - maxLength: 8191
- - type: 'null'
- __typename:
- type: string
- const: ElectricalPart
- default: ElectricalPart
- required:
- - id
- - name
- - created_at
- - voltage
- - manufacturer_id
Float:
type: number
GeoLocation:
@@ -369,46 +334,6 @@ json_schema_version: 1
- id
- name
- created_at
- Material:
- type: string
- enum:
- - ALLOY
- - CARBON_FIBER
- MechanicalPart:
- type: object
- properties:
- id:
- allOf:
- - "$ref": "#/$defs/ID"
- - maxLength: 8191
- name:
- anyOf:
- - allOf:
- - "$ref": "#/$defs/String"
- - maxLength: 8191
- - type: 'null'
- created_at:
- "$ref": "#/$defs/DateTime"
- material:
- anyOf:
- - "$ref": "#/$defs/Material"
- - type: 'null'
- manufacturer_id:
- anyOf:
- - allOf:
- - "$ref": "#/$defs/ID"
- - maxLength: 8191
- - type: 'null'
- __typename:
- type: string
- const: MechanicalPart
- default: MechanicalPart
- required:
- - id
- - name
- - created_at
- - material
- - manufacturer_id
Money:
type: object
properties:
The JSON schemas for these types should be retained, even though there is no longer an index definition directly on them. They are still a root type within an index.