Skip to content

Commit eafe197

Browse files
jwilsclaude
andcommitted
Pluggable ingestion serializers via new elasticgraph-json_ingestion gem
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c38985d commit eafe197

119 files changed

Lines changed: 2654 additions & 1505 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,10 @@ All gems follow the pattern: `elasticgraph-[name]/` containing:
8585
- `elasticgraph-elasticsearch`: Elasticsearch client wrapper
8686
- `elasticgraph-opensearch`: OpenSearch client wrapper
8787

88-
**Extensions** (5 gems): Optional functionality
88+
**Extensions** (6 gems): Optional functionality
8989
- `elasticgraph-apollo`: Apollo Federation support
9090
- `elasticgraph-health_check`: Health checks
91+
- `elasticgraph-json_ingestion`: JSON Schema ingestion serializer
9192
- `elasticgraph-query_interceptor`: Query interception
9293
- `elasticgraph-query_registry`: Source-controlled query registry
9394
- `elasticgraph-warehouse`: Data warehouse ingestion

CODEBASE_OVERVIEW.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ graph LR;
111111
rackup["rackup"];
112112
rake["rake"];
113113
webrick["webrick"];
114+
elasticgraph-json_ingestion["eg-json_ingestion"];
114115
elasticgraph-schema_artifacts["eg-schema_artifacts"];
115116
graphql["graphql"];
116117
elasticgraph --> elasticgraph-support;
@@ -125,6 +126,7 @@ graph LR;
125126
elasticgraph-local --> webrick;
126127
elasticgraph-schema_definition --> elasticgraph-graphql;
127128
elasticgraph-schema_definition --> elasticgraph-indexer;
129+
elasticgraph-schema_definition --> elasticgraph-json_ingestion;
128130
elasticgraph-schema_definition --> elasticgraph-schema_artifacts;
129131
elasticgraph-schema_definition --> elasticgraph-support;
130132
elasticgraph-schema_definition --> graphql;
@@ -141,6 +143,7 @@ graph LR;
141143
class rackup externalGemCatStyle;
142144
class rake externalGemCatStyle;
143145
class webrick externalGemCatStyle;
146+
class elasticgraph-json_ingestion otherEgGemStyle;
144147
class elasticgraph-schema_artifacts otherEgGemStyle;
145148
class graphql externalGemCatStyle;
146149
click thor href "https://rubygems.org/gems/thor" "Open on RubyGems.org" _blank;
@@ -192,12 +195,13 @@ graph LR;
192195
click opensearch-ruby href "https://rubygems.org/gems/opensearch-ruby" "Open on RubyGems.org" _blank;
193196
```
194197

195-
### Extensions (5 gems)
198+
### Extensions (6 gems)
196199

197200
These libraries extend ElasticGraph to provide optional but commonly needed functionality.
198201

199202
* [elasticgraph-apollo](elasticgraph-apollo/README.md): Transforms an ElasticGraph project into an Apollo subgraph.
200203
* [elasticgraph-health_check](elasticgraph-health_check/README.md): Provides a health check for high availability ElasticGraph deployments.
204+
* [elasticgraph-json_ingestion](elasticgraph-json_ingestion/README.md): JSON Schema ingestion support for ElasticGraph.
201205
* [elasticgraph-query_interceptor](elasticgraph-query_interceptor/README.md): Intercepts ElasticGraph datastore queries.
202206
* [elasticgraph-query_registry](elasticgraph-query_registry/README.md): Provides a source-controlled query registry for ElasticGraph applications.
203207
* [elasticgraph-warehouse](elasticgraph-warehouse/README.md): Extends ElasticGraph to support ingestion into a data warehouse.
@@ -216,6 +220,7 @@ graph LR;
216220
apollo-federation["apollo-federation"];
217221
elasticgraph-health_check["eg-health_check"];
218222
elasticgraph-datastore_core["eg-datastore_core"];
223+
elasticgraph-json_ingestion["eg-json_ingestion"];
219224
elasticgraph-query_interceptor["eg-query_interceptor"];
220225
elasticgraph-schema_artifacts["eg-schema_artifacts"];
221226
elasticgraph-query_registry["eg-query_registry"];
@@ -228,6 +233,7 @@ graph LR;
228233
elasticgraph-health_check --> elasticgraph-datastore_core;
229234
elasticgraph-health_check --> elasticgraph-graphql;
230235
elasticgraph-health_check --> elasticgraph-support;
236+
elasticgraph-json_ingestion --> elasticgraph-support;
231237
elasticgraph-query_interceptor --> elasticgraph-graphql;
232238
elasticgraph-query_interceptor --> elasticgraph-schema_artifacts;
233239
elasticgraph-query_registry --> elasticgraph-graphql;
@@ -242,6 +248,7 @@ graph LR;
242248
class apollo-federation externalGemCatStyle;
243249
class elasticgraph-health_check targetGemStyle;
244250
class elasticgraph-datastore_core otherEgGemStyle;
251+
class elasticgraph-json_ingestion targetGemStyle;
245252
class elasticgraph-query_interceptor targetGemStyle;
246253
class elasticgraph-schema_artifacts otherEgGemStyle;
247254
class elasticgraph-query_registry targetGemStyle;

Gemfile.lock

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ PATH
128128
elasticgraph-support (= 1.1.1.pre)
129129
hashdiff (~> 1.2, >= 1.2.1)
130130

131+
PATH
132+
remote: elasticgraph-json_ingestion
133+
specs:
134+
elasticgraph-json_ingestion (1.1.1.pre)
135+
elasticgraph-support (= 1.1.1.pre)
136+
131137
PATH
132138
remote: elasticgraph-lambda_support
133139
specs:
@@ -192,6 +198,7 @@ PATH
192198
elasticgraph-schema_definition (1.1.1.pre)
193199
elasticgraph-graphql (= 1.1.1.pre)
194200
elasticgraph-indexer (= 1.1.1.pre)
201+
elasticgraph-json_ingestion (= 1.1.1.pre)
195202
elasticgraph-schema_artifacts (= 1.1.1.pre)
196203
elasticgraph-support (= 1.1.1.pre)
197204
graphql (~> 2.6.1)
@@ -698,6 +705,7 @@ DEPENDENCIES
698705
elasticgraph-indexer (= 1.1.1.pre)!
699706
elasticgraph-indexer_autoscaler_lambda (= 1.1.1.pre)!
700707
elasticgraph-indexer_lambda (= 1.1.1.pre)!
708+
elasticgraph-json_ingestion (= 1.1.1.pre)!
701709
elasticgraph-lambda_support (= 1.1.1.pre)!
702710
elasticgraph-local (= 1.1.1.pre)!
703711
elasticgraph-opensearch (= 1.1.1.pre)!
@@ -789,6 +797,7 @@ CHECKSUMS
789797
elasticgraph-indexer (1.1.1.pre)
790798
elasticgraph-indexer_autoscaler_lambda (1.1.1.pre)
791799
elasticgraph-indexer_lambda (1.1.1.pre)
800+
elasticgraph-json_ingestion (1.1.1.pre)
792801
elasticgraph-lambda_support (1.1.1.pre)
793802
elasticgraph-local (1.1.1.pre)
794803
elasticgraph-opensearch (1.1.1.pre)

config/docker_demo/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ COPY elasticgraph-datastore_core elasticgraph-datastore_core/
1616
COPY elasticgraph-graphiql elasticgraph-graphiql/
1717
COPY elasticgraph-graphql elasticgraph-graphql/
1818
COPY elasticgraph-indexer elasticgraph-indexer/
19+
COPY elasticgraph-json_ingestion elasticgraph-json_ingestion/
1920
COPY elasticgraph-local elasticgraph-local/
2021
COPY elasticgraph-opensearch elasticgraph-opensearch/
2122
COPY elasticgraph-query_registry elasticgraph-query_registry/

config/site/support/doctest_helper.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
require "elastic_graph/apollo/schema_definition/api_extension"
1010
require "elastic_graph/schema_artifacts/runtime_metadata/schema_element_names"
1111
require "elastic_graph/schema_definition/api"
12+
require "elastic_graph/schema_definition/extension_module_support"
1213
require "elastic_graph/schema_definition/schema_artifact_manager"
1314
require "elastic_graph/warehouse/schema_definition/api_extension"
1415
require "rspec/mocks"
@@ -60,7 +61,7 @@ module ElasticGraph
6061
@api = SchemaDefinition::API.new(
6162
SchemaArtifacts::RuntimeMetadata::SchemaElementNames.new(form: :camelCase, overrides: {}),
6263
true,
63-
extension_modules: extension_modules
64+
extension_modules: SchemaDefinition::ExtensionModuleSupport.default_extension_modules + extension_modules
6465
)
6566

6667
# This is required in all schemas, but we don't want to have to put in all our examples,
@@ -95,7 +96,8 @@ module ElasticGraph
9596
ElasticGraph.define_schema do |schema|
9697
# `schema.json_schema_version` raises an error when the version is set more than once.
9798
# By default we set it above. Here we clear it to allow our example to set it.
98-
schema.state.json_schema_version = nil
99+
schema.state.ingestion_serializer_state.delete(:json_schema_version)
100+
schema.state.ingestion_serializer_state.delete(:json_schema_version_setter_location)
99101
end
100102
end
101103

elasticgraph-apollo/apollo_tests_implementation/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ COPY elasticgraph-elasticsearch /web/elasticgraph-elasticsearch
1414
COPY elasticgraph-graphiql /web/elasticgraph-graphiql
1515
COPY elasticgraph-graphql /web/elasticgraph-graphql
1616
COPY elasticgraph-indexer /web/elasticgraph-indexer
17+
COPY elasticgraph-json_ingestion /web/elasticgraph-json_ingestion
1718
COPY elasticgraph-rack /web/elasticgraph-rack
1819
COPY elasticgraph-schema_artifacts /web/elasticgraph-schema_artifacts
1920
COPY elasticgraph-schema_definition /web/elasticgraph-schema_definition

elasticgraph-apollo/apollo_tests_implementation/Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ source "https://rubygems.org"
1616
graphiql
1717
graphql
1818
indexer
19+
json_ingestion
1920
rack
2021
schema_artifacts
2122
schema_definition

elasticgraph-apollo/spec/unit/elastic_graph/apollo/apollo_directives_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ def self.with_both_casing_forms(&block)
552552
end
553553

554554
def define_schema(&block)
555-
extension_modules = [SchemaDefinition::APIExtension]
555+
extension_modules = ::ElasticGraph::SchemaDefinition::ExtensionModuleSupport.default_extension_modules + [SchemaDefinition::APIExtension]
556556
super(schema_element_name_form: schema_element_name_form, extension_modules: extension_modules, &block)
557557
end
558558
end

elasticgraph-apollo/spec/unit/elastic_graph/apollo/schema_definition_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,9 @@ def expect_identifiable_type_tagging_of_token(&type_def_for)
14181418
end
14191419

14201420
def define_schema(with_apollo: true, &block)
1421-
extension_modules = with_apollo ? [SchemaDefinition::APIExtension] : []
1421+
# Always include the JSON ingestion default so `Results#json_schemas_for` is available in both modes.
1422+
extension_modules = ::ElasticGraph::SchemaDefinition::ExtensionModuleSupport.default_extension_modules
1423+
extension_modules += [SchemaDefinition::APIExtension] if with_apollo
14221424
super(schema_element_name_form: schema_element_name_form, extension_modules: extension_modules, &block)
14231425
end
14241426
end

elasticgraph-json_ingestion/.rspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../spec_support/subdir_dot_rspec

0 commit comments

Comments
 (0)