Skip to content

Commit a3cfa5c

Browse files
jwilsclaude
andcommitted
Prototype pluggable ingestion serializers via new elasticgraph-json_schema gem
Extracts JSON Schema generation and artifact management from the core elasticgraph-schema_definition gem into a new elasticgraph-json_schema extension gem. This follows the established extension pattern used by elasticgraph-warehouse and elasticgraph-apollo (APIExtension, FactoryExtension, ResultsExtension, SchemaArtifactManagerExtension). This is the first step toward supporting pluggable ingestion serializers as proposed in discussion #1059. A future elasticgraph-protobuf gem could implement the same interface to support Protocol Buffer ingestion. The JSON Schema serializer is auto-applied by default in API#initialize for full backward compatibility — no configuration changes are needed for existing users. What moved: - json_schema_version() and json_schema_strictness() from API - JSON schema building methods from Results - JSON schema artifact generation from SchemaArtifactManager What stays in core: - State fields, constants, FromDisk, RecordPreparer, Operation::Factory - FieldType#to_json_schema, EventEnvelope, JSONSchemaWithMetadata Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 89b5446 commit a3cfa5c

36 files changed

Lines changed: 860 additions & 376 deletions

File tree

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_schema`: 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_schema["eg-json_schema"];
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_schema;
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_schema 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_schema](elasticgraph-json_schema/README.md): Pluggable JSON Schema ingestion serializer 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_schema["eg-json_schema"];
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_schema --> 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_schema 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_schema
133+
specs:
134+
elasticgraph-json_schema (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_schema (= 1.1.1.pre)
195202
elasticgraph-schema_artifacts (= 1.1.1.pre)
196203
elasticgraph-support (= 1.1.1.pre)
197204
graphql (~> 2.5.21)
@@ -696,6 +703,7 @@ DEPENDENCIES
696703
elasticgraph-indexer (= 1.1.1.pre)!
697704
elasticgraph-indexer_autoscaler_lambda (= 1.1.1.pre)!
698705
elasticgraph-indexer_lambda (= 1.1.1.pre)!
706+
elasticgraph-json_schema (= 1.1.1.pre)!
699707
elasticgraph-lambda_support (= 1.1.1.pre)!
700708
elasticgraph-local (= 1.1.1.pre)!
701709
elasticgraph-opensearch (= 1.1.1.pre)!
@@ -787,6 +795,7 @@ CHECKSUMS
787795
elasticgraph-indexer (1.1.1.pre)
788796
elasticgraph-indexer_autoscaler_lambda (1.1.1.pre)
789797
elasticgraph-indexer_lambda (1.1.1.pre)
798+
elasticgraph-json_schema (1.1.1.pre)
790799
elasticgraph-lambda_support (1.1.1.pre)
791800
elasticgraph-local (1.1.1.pre)
792801
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_schema elasticgraph-json_schema/
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 & 1 deletion
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,9 @@ 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.build_api_extension_modules(
65+
extension_modules: extension_modules
66+
)
6467
)
6568

6669
# This is required in all schemas, but we don't want to have to put in all our examples,

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_schema /web/elasticgraph-json_schema
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_schema
1920
rack
2021
schema_artifacts
2122
schema_definition

elasticgraph-json_schema/.rspec

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

elasticgraph-json_schema/.yardopts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../config/site/yardopts

elasticgraph-json_schema/Gemfile

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

0 commit comments

Comments
 (0)