Skip to content

Commit 052d30a

Browse files
committed
Add schema definition extension plumbing
1 parent a099965 commit 052d30a

34 files changed

Lines changed: 115 additions & 99 deletions

File tree

Rakefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ end
4646

4747
configure_local_rake_tasks = ->(tasks) do
4848
tasks.schema_element_name_form = :snake_case
49-
tasks.enforce_json_schema_version = false
5049
tasks.index_document_sizes = true
5150
tasks.env_port_mapping = {test: test_port}
5251
tasks.output = schema_def_output

config/schema.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
ElasticGraph.define_schema do |schema|
1010
schema.json_schema_version 1
11+
schema.enforce_json_schema_version false
1112
end
1213

1314
# Note: anytime you add a file to load here, you'll also have to update the list here:

config/site/Rakefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,6 @@ module ElasticGraph
448448
namespace schema_name do
449449
::ElasticGraph::Local::RakeTasks.new(local_config_yaml: settings_file, path_to_schema: schema_file) do |tasks|
450450
tasks.opensearch_versions = []
451-
tasks.enforce_json_schema_version = false
452451
end
453452

454453
task validate: ["schema_artifacts:dump"] do

config/site/examples/custom_resolver/schema.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
ElasticGraph.define_schema do |schema|
1212
schema.json_schema_version 1
13+
schema.enforce_json_schema_version false
1314

1415
# :snippet-start: register_graphql_resolver
1516
require(require_path = "roll_dice_resolver")

config/site/examples/music/schema.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
ElasticGraph.define_schema do |schema|
1212
schema.json_schema_version 1
13+
schema.enforce_json_schema_version false
1314
end
1415

1516
Dir["#{__dir__}/schema/**/*.rb"].each do |schema_def_file|

config/site/examples/music_simplified/schema.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
ElasticGraph.define_schema do |schema|
22
schema.json_schema_version 1
3+
schema.enforce_json_schema_version false
34

45
schema.object_type "Artist" do |t|
56
t.field "id", "ID"

config/site/support/doctest_helper.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ module ElasticGraph
8282
artifacts_manager = @api.factory.new_schema_artifact_manager(
8383
schema_definition_results: @api.results,
8484
schema_artifacts_directory: "#{@tmp_dir}/schema_artifacts",
85-
enforce_json_schema_version: true,
8685
output: ::StringIO.new
8786
)
8887

elasticgraph-admin/spec/integration/elastic_graph/admin/index_definition_configurator/for_index_template_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ def fetch_artifact_configuration(schema_artifacts, index_def_name)
167167
factory.new_schema_artifact_manager(
168168
schema_definition_results: schema_def_results,
169169
schema_artifacts_directory: Dir.pwd,
170-
enforce_json_schema_version: true,
171170
output: output_io
172171
).dump_artifacts
173172

elasticgraph-apollo/README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,14 @@ index 2943335..26633c3 100644
6464
require "elastic_graph/local/rake_tasks"
6565
require "elastic_graph/query_registry/rake_tasks"
6666
require "rspec/core/rake_task"
67-
@@ -12,6 +13,8 @@ ElasticGraph::Local::RakeTasks.new(
67+
@@ -12,5 +13,7 @@ ElasticGraph::Local::RakeTasks.new(
6868
local_config_yaml: settings_file,
6969
path_to_schema: "#{project_root}/config/schema.rb"
7070
) do |tasks|
7171
+ tasks.schema_definition_extension_modules = [ElasticGraph::Apollo::SchemaDefinition::APIExtension]
7272
+
73-
# Set this to true once you're beyond the prototyping stage.
74-
tasks.enforce_json_schema_version = false
75-
73+
# Determines casing of field names. Can be either `:camelCase` or `:snake_case`.
74+
tasks.schema_element_name_form = :camelCase
7675
```
7776

7877
That's it!
@@ -94,11 +93,16 @@ diff --git a/config/schema.rb b/config/schema.rb
9493
index 015c5fa..362cdcb 100644
9594
--- a/config/schema.rb
9695
+++ b/config/schema.rb
97-
@@ -4,6 +4,8 @@ ElasticGraph.define_schema do |schema|
96+
@@ -4,7 +4,9 @@ ElasticGraph.define_schema do |schema|
9897
# ElasticGraph will tell you when you need to bump this.
9998
schema.json_schema_version 1
100-
99+
-
100+
+
101101
+ schema.target_apollo_federation_version "2.3"
102+
+
103+
# Set this to true once you're beyond the prototyping stage.
104+
schema.enforce_json_schema_version false
105+
-
102106
+
103107
# This registers the elasticgraph-query_registry extension, which can be used to reject queries that
104108
# clients have not registered (and to reject queries that differ from what a client has registered).

elasticgraph-apollo/apollo_tests_implementation/Rakefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@ ElasticGraph::SchemaDefinition::RakeTasks.new(
1717
index_document_sizes: false,
1818
path_to_schema: project_root / "config/products_schema.rb",
1919
schema_artifacts_directory: project_root / "config/schema/artifacts",
20-
extension_modules: [ElasticGraph::Apollo::SchemaDefinition::APIExtension],
21-
enforce_json_schema_version: false
20+
extension_modules: [ElasticGraph::Apollo::SchemaDefinition::APIExtension]
2221
)

0 commit comments

Comments
 (0)