From 63b3c9f2bf8384991b6555269a96ed3cc9d3cbc3 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Wed, 20 May 2026 13:02:39 -0500 Subject: [PATCH] Add json ingestion gem shell --- CODEBASE_OVERVIEW.md | 6 ++- Gemfile.lock | 8 ++++ elasticgraph-json_ingestion/.rspec | 1 + elasticgraph-json_ingestion/.yardopts | 1 + elasticgraph-json_ingestion/Gemfile | 1 + elasticgraph-json_ingestion/LICENSE.txt | 21 +++++++++ elasticgraph-json_ingestion/README.md | 20 +++++++++ .../elasticgraph-json_ingestion.gemspec | 45 +++++++++++++++++++ .../lib/elastic_graph/json_ingestion.rb | 13 ++++++ elasticgraph-support/README.md | 3 ++ 10 files changed, 118 insertions(+), 1 deletion(-) create mode 120000 elasticgraph-json_ingestion/.rspec create mode 120000 elasticgraph-json_ingestion/.yardopts create mode 120000 elasticgraph-json_ingestion/Gemfile create mode 100644 elasticgraph-json_ingestion/LICENSE.txt create mode 100644 elasticgraph-json_ingestion/README.md create mode 100644 elasticgraph-json_ingestion/elasticgraph-json_ingestion.gemspec create mode 100644 elasticgraph-json_ingestion/lib/elastic_graph/json_ingestion.rb diff --git a/CODEBASE_OVERVIEW.md b/CODEBASE_OVERVIEW.md index d6e62ebfd..a7f4b58ea 100644 --- a/CODEBASE_OVERVIEW.md +++ b/CODEBASE_OVERVIEW.md @@ -192,12 +192,13 @@ graph LR; click opensearch-ruby href "https://rubygems.org/gems/opensearch-ruby" "Open on RubyGems.org" _blank; ``` -### Extensions (5 gems) +### Extensions (6 gems) These libraries extend ElasticGraph to provide optional but commonly needed functionality. * [elasticgraph-apollo](elasticgraph-apollo/README.md): Transforms an ElasticGraph project into an Apollo subgraph. * [elasticgraph-health_check](elasticgraph-health_check/README.md): Provides a health check for high availability ElasticGraph deployments. +* [elasticgraph-json_ingestion](elasticgraph-json_ingestion/README.md): JSON Schema ingestion support for ElasticGraph. * [elasticgraph-query_interceptor](elasticgraph-query_interceptor/README.md): Intercepts ElasticGraph datastore queries. * [elasticgraph-query_registry](elasticgraph-query_registry/README.md): Provides a source-controlled query registry for ElasticGraph applications. * [elasticgraph-warehouse](elasticgraph-warehouse/README.md): Extends ElasticGraph to support ingestion into a data warehouse. @@ -216,6 +217,7 @@ graph LR; apollo-federation["apollo-federation"]; elasticgraph-health_check["eg-health_check"]; elasticgraph-datastore_core["eg-datastore_core"]; + elasticgraph-json_ingestion["eg-json_ingestion"]; elasticgraph-query_interceptor["eg-query_interceptor"]; elasticgraph-schema_artifacts["eg-schema_artifacts"]; elasticgraph-query_registry["eg-query_registry"]; @@ -228,6 +230,7 @@ graph LR; elasticgraph-health_check --> elasticgraph-datastore_core; elasticgraph-health_check --> elasticgraph-graphql; elasticgraph-health_check --> elasticgraph-support; + elasticgraph-json_ingestion --> elasticgraph-support; elasticgraph-query_interceptor --> elasticgraph-graphql; elasticgraph-query_interceptor --> elasticgraph-schema_artifacts; elasticgraph-query_registry --> elasticgraph-graphql; @@ -242,6 +245,7 @@ graph LR; class apollo-federation externalGemCatStyle; class elasticgraph-health_check targetGemStyle; class elasticgraph-datastore_core otherEgGemStyle; + class elasticgraph-json_ingestion targetGemStyle; class elasticgraph-query_interceptor targetGemStyle; class elasticgraph-schema_artifacts otherEgGemStyle; class elasticgraph-query_registry targetGemStyle; diff --git a/Gemfile.lock b/Gemfile.lock index 56c78f4c8..42a41bcc2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -128,6 +128,12 @@ PATH elasticgraph-support (= 1.2.1.pre) hashdiff (~> 1.2, >= 1.2.1) +PATH + remote: elasticgraph-json_ingestion + specs: + elasticgraph-json_ingestion (1.2.1.pre) + elasticgraph-support (= 1.2.1.pre) + PATH remote: elasticgraph-lambda_support specs: @@ -698,6 +704,7 @@ DEPENDENCIES elasticgraph-indexer (= 1.2.1.pre)! elasticgraph-indexer_autoscaler_lambda (= 1.2.1.pre)! elasticgraph-indexer_lambda (= 1.2.1.pre)! + elasticgraph-json_ingestion (= 1.2.1.pre)! elasticgraph-lambda_support (= 1.2.1.pre)! elasticgraph-local (= 1.2.1.pre)! elasticgraph-opensearch (= 1.2.1.pre)! @@ -789,6 +796,7 @@ CHECKSUMS elasticgraph-indexer (1.2.1.pre) elasticgraph-indexer_autoscaler_lambda (1.2.1.pre) elasticgraph-indexer_lambda (1.2.1.pre) + elasticgraph-json_ingestion (1.2.1.pre) elasticgraph-lambda_support (1.2.1.pre) elasticgraph-local (1.2.1.pre) elasticgraph-opensearch (1.2.1.pre) diff --git a/elasticgraph-json_ingestion/.rspec b/elasticgraph-json_ingestion/.rspec new file mode 120000 index 000000000..67e6e21b3 --- /dev/null +++ b/elasticgraph-json_ingestion/.rspec @@ -0,0 +1 @@ +../spec_support/subdir_dot_rspec \ No newline at end of file diff --git a/elasticgraph-json_ingestion/.yardopts b/elasticgraph-json_ingestion/.yardopts new file mode 120000 index 000000000..e11a2057f --- /dev/null +++ b/elasticgraph-json_ingestion/.yardopts @@ -0,0 +1 @@ +../config/site/yardopts \ No newline at end of file diff --git a/elasticgraph-json_ingestion/Gemfile b/elasticgraph-json_ingestion/Gemfile new file mode 120000 index 000000000..26cb2ad91 --- /dev/null +++ b/elasticgraph-json_ingestion/Gemfile @@ -0,0 +1 @@ +../Gemfile \ No newline at end of file diff --git a/elasticgraph-json_ingestion/LICENSE.txt b/elasticgraph-json_ingestion/LICENSE.txt new file mode 100644 index 000000000..aa18b5db8 --- /dev/null +++ b/elasticgraph-json_ingestion/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2024 - 2026 Block, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/elasticgraph-json_ingestion/README.md b/elasticgraph-json_ingestion/README.md new file mode 100644 index 000000000..db1eb3988 --- /dev/null +++ b/elasticgraph-json_ingestion/README.md @@ -0,0 +1,20 @@ +# ElasticGraph::JSONIngestion + +JSON Schema ingestion support for ElasticGraph. + +This gem provides the schema-definition extension that generates JSON Schema artifacts for indexing +events and validates JSON-ingestion-specific schema options. + +## Dependency Diagram + +```mermaid +graph LR; + classDef targetGemStyle fill:#FADBD8,stroke:#EC7063,color:#000,stroke-width:2px; + classDef otherEgGemStyle fill:#A9DFBF,stroke:#2ECC71,color:#000; + classDef externalGemStyle fill:#E0EFFF,stroke:#70A1D7,color:#2980B9; + elasticgraph-json_ingestion["elasticgraph-json_ingestion"]; + class elasticgraph-json_ingestion targetGemStyle; + elasticgraph-support["elasticgraph-support"]; + elasticgraph-json_ingestion --> elasticgraph-support; + class elasticgraph-support otherEgGemStyle; +``` diff --git a/elasticgraph-json_ingestion/elasticgraph-json_ingestion.gemspec b/elasticgraph-json_ingestion/elasticgraph-json_ingestion.gemspec new file mode 100644 index 000000000..33c80f558 --- /dev/null +++ b/elasticgraph-json_ingestion/elasticgraph-json_ingestion.gemspec @@ -0,0 +1,45 @@ +# Copyright 2024 - 2026 Block, Inc. +# +# Use of this source code is governed by an MIT-style +# license that can be found in the LICENSE file or at +# https://opensource.org/licenses/MIT. +# +# frozen_string_literal: true + +require_relative "../elasticgraph-support/lib/elastic_graph/version" + +Gem::Specification.new do |spec| + spec.name = "elasticgraph-json_ingestion" + spec.version = ElasticGraph::VERSION + spec.authors = ["Josh Wilson", "Myron Marston", "Block Engineering"] + spec.email = ["joshuaw@squareup.com"] + spec.homepage = "https://block.github.io/elasticgraph/" + spec.license = "MIT" + spec.summary = "JSON Schema ingestion support for ElasticGraph." + + spec.metadata = { + "bug_tracker_uri" => "https://github.com/block/elasticgraph/issues", + "changelog_uri" => "https://github.com/block/elasticgraph/releases/tag/v#{ElasticGraph::VERSION}", + "documentation_uri" => "https://block.github.io/elasticgraph/api-docs/v#{ElasticGraph::VERSION}/", + "homepage_uri" => "https://block.github.io/elasticgraph/", + "source_code_uri" => "https://github.com/block/elasticgraph/tree/v#{ElasticGraph::VERSION}/#{spec.name}", + "gem_category" => "extension" + } + + spec.files = Dir.chdir(File.expand_path(__dir__)) do + `git ls-files -z`.split("\x0").reject do |f| + (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features|sig)/|\.(?:git|travis|circleci)|appveyor)}) + end - [".rspec", "Gemfile", ".yardopts"] + end + + spec.required_ruby_version = [">= 3.4", "< 4.1"] + + # This gem `prepend`s/`extend`s modules onto `ElasticGraph::SchemaDefinition::API` at runtime, so its + # code requires `elasticgraph-schema_definition` to be loaded. We declare that as a *development* + # dependency rather than a runtime dependency to keep the gem-spec dep direction acyclic: + # `elasticgraph-schema_definition` runtime-depends on this gem (so installing `schema_definition` + # always pulls in this serializer by default), and this gem's code references `schema_definition` only + # via paths that are always already loaded by the time this gem is required. + spec.add_development_dependency "elasticgraph-schema_definition", ElasticGraph::VERSION + spec.add_dependency "elasticgraph-support", ElasticGraph::VERSION +end diff --git a/elasticgraph-json_ingestion/lib/elastic_graph/json_ingestion.rb b/elasticgraph-json_ingestion/lib/elastic_graph/json_ingestion.rb new file mode 100644 index 000000000..90c9217c3 --- /dev/null +++ b/elasticgraph-json_ingestion/lib/elastic_graph/json_ingestion.rb @@ -0,0 +1,13 @@ +# Copyright 2024 - 2026 Block, Inc. +# +# Use of this source code is governed by an MIT-style +# license that can be found in the LICENSE file or at +# https://opensource.org/licenses/MIT. +# +# frozen_string_literal: true + +module ElasticGraph + # JSON ingestion support for ElasticGraph. + module JSONIngestion + end +end diff --git a/elasticgraph-support/README.md b/elasticgraph-support/README.md index 91f3096dc..8464cbc88 100644 --- a/elasticgraph-support/README.md +++ b/elasticgraph-support/README.md @@ -45,6 +45,9 @@ graph LR; elasticgraph-indexer["elasticgraph-indexer"]; elasticgraph-indexer --> elasticgraph-support; class elasticgraph-indexer otherEgGemStyle; + elasticgraph-json_ingestion["elasticgraph-json_ingestion"]; + elasticgraph-json_ingestion --> elasticgraph-support; + class elasticgraph-json_ingestion otherEgGemStyle; elasticgraph-opensearch["elasticgraph-opensearch"]; elasticgraph-opensearch --> elasticgraph-support; class elasticgraph-opensearch otherEgGemStyle;