-
Notifications
You must be signed in to change notification settings - Fork 30
Scaffold the elasticgraph-proto_ingestion gem #1297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../spec_support/subdir_dot_rspec |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../config/site/yardopts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../Gemfile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # ElasticGraph::ProtoIngestion | ||
|
|
||
| An ElasticGraph extension that supports ingesting Protocol Buffer data into ElasticGraph. | ||
|
|
||
| ## 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-proto_ingestion["elasticgraph-proto_ingestion"]; | ||
| class elasticgraph-proto_ingestion targetGemStyle; | ||
| elasticgraph-support["elasticgraph-support"]; | ||
| elasticgraph-proto_ingestion --> elasticgraph-support; | ||
| class elasticgraph-support otherEgGemStyle; | ||
| ``` |
40 changes: 40 additions & 0 deletions
40
elasticgraph-proto_ingestion/elasticgraph-proto_ingestion.gemspec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # 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-proto_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 = "Supports ingesting Protocol Buffer data into 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"] | ||
|
|
||
| spec.add_dependency "elasticgraph-support", ElasticGraph::VERSION | ||
|
|
||
| spec.add_development_dependency "elasticgraph-schema_definition", ElasticGraph::VERSION | ||
| end |
18 changes: 18 additions & 0 deletions
18
elasticgraph-proto_ingestion/lib/elastic_graph/proto_ingestion.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # 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 | ||
| # Namespace for Protocol Buffers schema artifact generation extensions. | ||
| module ProtoIngestion | ||
| # The name of the generated Protocol Buffers schema file. | ||
| PROTO_SCHEMA_FILE = "schema.proto" | ||
|
|
||
| # The name of the generated proto field-number mapping file. | ||
| PROTO_FIELD_NUMBERS_FILE = "proto_field_numbers.yaml" | ||
| end | ||
| end |
26 changes: 26 additions & 0 deletions
26
...raph-proto_ingestion/lib/elastic_graph/proto_ingestion/schema_definition/api_extension.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # 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 "elastic_graph/proto_ingestion" | ||
|
|
||
| module ElasticGraph | ||
| module ProtoIngestion | ||
| # Namespace for all protobuf schema definition support. | ||
| # | ||
| # {SchemaDefinition::APIExtension} is the primary entry point and should be used as a schema definition extension module. | ||
| module SchemaDefinition | ||
| # Module designed to be extended onto an {ElasticGraph::SchemaDefinition::API} instance | ||
| # to enable protobuf schema artifact generation. | ||
| # | ||
| # @note The protobuf schema artifact generation logic has not been implemented yet, so | ||
| # extending this module is currently a no-op. | ||
| module APIExtension | ||
| end | ||
| end | ||
| end | ||
| end |
6 changes: 6 additions & 0 deletions
6
elasticgraph-proto_ingestion/sig/elastic_graph/proto_ingestion.rbs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| module ElasticGraph | ||
| module ProtoIngestion | ||
| PROTO_SCHEMA_FILE: ::String | ||
| PROTO_FIELD_NUMBERS_FILE: ::String | ||
| end | ||
| end |
8 changes: 8 additions & 0 deletions
8
...aph-proto_ingestion/sig/elastic_graph/proto_ingestion/schema_definition/api_extension.rbs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| module ElasticGraph | ||
| module ProtoIngestion | ||
| module SchemaDefinition | ||
| module APIExtension | ||
| end | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # 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 | ||
|
|
||
| # This file contains RSpec configuration for `elasticgraph-proto_ingestion`. | ||
| # It is loaded by the shared spec helper at `spec_support/spec_helper.rb`. |
33 changes: 33 additions & 0 deletions
33
...ingestion/spec/unit/elastic_graph/proto_ingestion/schema_definition/api_extension_spec.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # 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 "elastic_graph/proto_ingestion/schema_definition/api_extension" | ||
| require "elastic_graph/spec_support/schema_definition_helpers" | ||
|
|
||
| module ElasticGraph | ||
| module ProtoIngestion | ||
| module SchemaDefinition | ||
| RSpec.describe APIExtension do | ||
| include_context "SchemaDefinitionHelpers" | ||
|
|
||
| it "can be used as a schema definition extension module, without customizing the schema definition yet" do | ||
| with_extension, without_extension = [[APIExtension], []].map do |extension_modules| | ||
| define_schema(schema_element_name_form: "snake_case", extension_modules: extension_modules) do |schema| | ||
| schema.object_type "Widget" do |t| | ||
| t.field "id", "ID!" | ||
| t.index "widgets" | ||
| end | ||
| end.graphql_schema_string | ||
| end | ||
|
|
||
| expect(with_extension).to eq(without_extension) | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end | ||
21 changes: 21 additions & 0 deletions
21
elasticgraph-proto_ingestion/spec/unit/elastic_graph/proto_ingestion_spec.rb
|
jwils marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # 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 "elastic_graph/proto_ingestion" | ||
|
|
||
| module ElasticGraph | ||
| RSpec.describe ProtoIngestion do | ||
| it "defines the PROTO_SCHEMA_FILE constant" do | ||
| expect(ProtoIngestion::PROTO_SCHEMA_FILE).to eq("schema.proto") | ||
| end | ||
|
|
||
| it "defines the PROTO_FIELD_NUMBERS_FILE constant" do | ||
| expect(ProtoIngestion::PROTO_FIELD_NUMBERS_FILE).to eq("proto_field_numbers.yaml") | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.