Skip to content

Commit d29bd5d

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) <noreply@anthropic.com>
1 parent 89b5446 commit d29bd5d

22 files changed

Lines changed: 638 additions & 371 deletions

File tree

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/

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
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2024 - 2026 Block, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

elasticgraph-json_schema/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# ElasticGraph::JsonSchema
2+
3+
Pluggable JSON Schema ingestion serializer for ElasticGraph.
4+
5+
This gem extracts the JSON Schema generation and validation logic from ElasticGraph's core into a
6+
pluggable extension, following the same pattern as `elasticgraph-warehouse` and `elasticgraph-apollo`.
7+
This is the first step toward supporting alternative ingestion serializers (e.g., Protocol Buffers).
8+
9+
The JSON Schema serializer is auto-applied by default for backward compatibility — no configuration
10+
changes are needed for existing users.
11+
12+
## Dependency Diagram
13+
14+
```mermaid
15+
graph LR;
16+
classDef targetGemStyle fill:#FADBD8,stroke:#EC7063,color:#000,stroke-width:2px;
17+
classDef otherEgGemStyle fill:#A9DFBF,stroke:#2ECC71,color:#000;
18+
classDef externalGemStyle fill:#E0EFFF,stroke:#70A1D7,color:#2980B9;
19+
elasticgraph-json_schema["elasticgraph-json_schema"];
20+
class elasticgraph-json_schema targetGemStyle;
21+
elasticgraph-support["elasticgraph-support"];
22+
elasticgraph-json_schema --> elasticgraph-support;
23+
class elasticgraph-support otherEgGemStyle;
24+
elasticgraph-schema_definition["elasticgraph-schema_definition"];
25+
elasticgraph-schema_definition --> elasticgraph-json_schema;
26+
class elasticgraph-schema_definition otherEgGemStyle;
27+
```

0 commit comments

Comments
 (0)