elasticgraph-schema_artifacts 1.0.0.rc3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2173ff8c84a7c1ee9170dd00a8e8d2193e6ffceec4fb0c9e66492b7affdedabf
4
- data.tar.gz: 71638cad65652eafcaaa0cbdb34727aaadedf7d1d4c27e76dfc2c882f7e1358e
3
+ metadata.gz: f614f488ed50162571c9c5df096b7cc8c06785f1f1b364f702c67a1558a1426f
4
+ data.tar.gz: f107371645d484100628967f067b5dc29c5b9e274ddc4d8dc462c497f1689406
5
5
  SHA512:
6
- metadata.gz: ff8228ee7aaeeaaf85e03f6333b1613de7f1a3a6ed73607f10821b6e3f5b123d5e50de7b3a015f1186504d66d3931c204f3314d641a21456185bbe9cfc5647b8
7
- data.tar.gz: 0337417d2246da9439688563271a027a7f7a4c3c17d38f5d691f8609a4bc4a52e6ee3d25076bb576079929371f69edd532b64090950503744c42a35ffafa3164
6
+ metadata.gz: 6e2df97965c644d519af306754e0c8e5b29dcda4315c28fd5009b498fa23971e8237d7005037b2d079892c4bfe31dbf9b243279dcee856952698b923441bf3e5
7
+ data.tar.gz: e070c0e111edcbb4a545e7bc5ab05c781f5c2e7df68776609ee0da62acd6053e0bebc9c2052c216d017944255524e93840ed426c790dc98e159b182f89e10e69
data/README.md CHANGED
@@ -33,3 +33,19 @@ graph LR;
33
33
  elasticgraph-schema_definition --> elasticgraph-schema_artifacts;
34
34
  class elasticgraph-schema_definition otherEgGemStyle;
35
35
  ```
36
+
37
+ ## Usage
38
+
39
+ `elasticgraph-schema_artifacts` is used internally by the other parts of ElasticGraph, but it can also be used directly:
40
+
41
+ ```ruby
42
+ require "elastic_graph/schema_artifacts"
43
+
44
+ artifacts = ElasticGraph::SchemaArtifacts.from_yaml_file("config/settings/local.yaml")
45
+
46
+ # The `artifacts` object provides access to the various schema artifacts:
47
+ artifacts.graphql_schema_string
48
+ artifacts.datastore_config
49
+ artifacts.runtime_metadata
50
+ artifacts.json_schemas_for(artifacts.latest_json_schema_version)
51
+ ```
@@ -10,35 +10,11 @@ require "elastic_graph/constants"
10
10
  require "elastic_graph/errors"
11
11
  require "elastic_graph/schema_artifacts/artifacts_helper_methods"
12
12
  require "elastic_graph/schema_artifacts/runtime_metadata/schema"
13
- require "elastic_graph/support/hash_util"
14
13
  require "elastic_graph/support/memoizable_data"
15
14
  require "yaml"
16
15
 
17
16
  module ElasticGraph
18
- # Namespace for all code related to ElasticGraph schema artifacts.
19
- # Schema artifacts are generated by {SchemaDefinition} and dumped to disk.
20
- # Later, they are used to power ElasticGraph.
21
17
  module SchemaArtifacts
22
- # Builds a `SchemaArtifacts::FromDisk` instance using the provided YAML settings.
23
- #
24
- # @param parsed_yaml [Hash<String, Object>] hash parsed from a settings YAML file
25
- # @return [FromDisk]
26
- def self.from_parsed_yaml(parsed_yaml)
27
- schema_artifacts = parsed_yaml.fetch("schema_artifacts") do
28
- raise Errors::ConfigError, "Config is missing required key `schema_artifacts`."
29
- end
30
-
31
- if (extra_keys = schema_artifacts.keys - ["directory"]).any?
32
- raise Errors::ConfigError, "Config has extra `schema_artifacts` keys: #{extra_keys}"
33
- end
34
-
35
- directory = schema_artifacts.fetch("directory") do
36
- raise Errors::ConfigError, "Config is missing required key `schema_artifacts.directory`."
37
- end
38
-
39
- FromDisk.new(directory)
40
- end
41
-
42
18
  # Responsible for loading schema artifacts from disk and providing access to each artifact.
43
19
  #
44
20
  # @!attribute [r] artifacts_dir
@@ -0,0 +1,40 @@
1
+ # Copyright 2024 - 2025 Block, Inc.
2
+ #
3
+ # Use of this source code is governed by an MIT-style
4
+ # license that can be found in the LICENSE file or at
5
+ # https://opensource.org/licenses/MIT.
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ require "elastic_graph/errors"
10
+ require "elastic_graph/schema_artifacts/from_disk"
11
+ require "elastic_graph/support/from_yaml_file"
12
+
13
+ module ElasticGraph
14
+ # Namespace for all code related to ElasticGraph schema artifacts.
15
+ # Schema artifacts are generated by {SchemaDefinition} and dumped to disk.
16
+ # Later, they are used to power ElasticGraph.
17
+ module SchemaArtifacts
18
+ extend Support::FromYamlFile
19
+
20
+ # Builds a `SchemaArtifacts::FromDisk` instance using the provided YAML settings.
21
+ #
22
+ # @param parsed_yaml [Hash<String, Object>] hash parsed from a settings YAML file
23
+ # @return [FromDisk]
24
+ def self.from_parsed_yaml(parsed_yaml)
25
+ schema_artifacts = parsed_yaml.fetch("schema_artifacts") do
26
+ raise Errors::ConfigError, "Config is missing required key `schema_artifacts`."
27
+ end
28
+
29
+ if (extra_keys = schema_artifacts.keys - ["directory"]).any?
30
+ raise Errors::ConfigError, "Config has extra `schema_artifacts` keys: #{extra_keys}"
31
+ end
32
+
33
+ directory = schema_artifacts.fetch("directory") do
34
+ raise Errors::ConfigError, "Config is missing required key `schema_artifacts.directory`."
35
+ end
36
+
37
+ FromDisk.new(directory)
38
+ end
39
+ end
40
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticgraph-schema_artifacts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Myron Marston
@@ -17,42 +17,42 @@ dependencies:
17
17
  requirements:
18
18
  - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: 1.0.0.rc3
20
+ version: 1.0.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '='
26
26
  - !ruby/object:Gem::Version
27
- version: 1.0.0.rc3
27
+ version: 1.0.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: elasticgraph-graphql
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - '='
33
33
  - !ruby/object:Gem::Version
34
- version: 1.0.0.rc3
34
+ version: 1.0.0
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 1.0.0.rc3
41
+ version: 1.0.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: elasticgraph-indexer
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: 1.0.0.rc3
48
+ version: 1.0.0
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - '='
54
54
  - !ruby/object:Gem::Version
55
- version: 1.0.0.rc3
55
+ version: 1.0.0
56
56
  email:
57
57
  - myron@squareup.com
58
58
  executables: []
@@ -61,6 +61,7 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - LICENSE.txt
63
63
  - README.md
64
+ - lib/elastic_graph/schema_artifacts.rb
64
65
  - lib/elastic_graph/schema_artifacts/artifacts_helper_methods.rb
65
66
  - lib/elastic_graph/schema_artifacts/from_disk.rb
66
67
  - lib/elastic_graph/schema_artifacts/runtime_metadata/computation_detail.rb
@@ -88,10 +89,10 @@ licenses:
88
89
  - MIT
89
90
  metadata:
90
91
  bug_tracker_uri: https://github.com/block/elasticgraph/issues
91
- changelog_uri: https://github.com/block/elasticgraph/releases/tag/v1.0.0.rc3
92
- documentation_uri: https://block.github.io/elasticgraph/api-docs/v1.0.0.rc3/
92
+ changelog_uri: https://github.com/block/elasticgraph/releases/tag/v1.0.0
93
+ documentation_uri: https://block.github.io/elasticgraph/api-docs/v1.0.0/
93
94
  homepage_uri: https://block.github.io/elasticgraph/
94
- source_code_uri: https://github.com/block/elasticgraph/tree/v1.0.0.rc3/elasticgraph-schema_artifacts
95
+ source_code_uri: https://github.com/block/elasticgraph/tree/v1.0.0/elasticgraph-schema_artifacts
95
96
  gem_category: core
96
97
  rdoc_options: []
97
98
  require_paths:
@@ -110,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
111
  - !ruby/object:Gem::Version
111
112
  version: '0'
112
113
  requirements: []
113
- rubygems_version: 3.6.7
114
+ rubygems_version: 3.6.9
114
115
  specification_version: 4
115
- summary: ElasticGraph gem containing code related to generated schema artifacts.
116
+ summary: Provides access to ElasticGraph schema artifacts.
116
117
  test_files: []