elasticgraph-schema_definition 0.19.3.0 → 1.0.0.rc2
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 +4 -4
- data/README.md +41 -0
- data/lib/elastic_graph/schema_definition/factory.rb +15 -1
- data/lib/elastic_graph/schema_definition/mixins/has_indices.rb +2 -2
- data/lib/elastic_graph/schema_definition/mixins/has_type_info.rb +1 -1
- data/lib/elastic_graph/schema_definition/mixins/supports_filtering_and_aggregation.rb +16 -1
- data/lib/elastic_graph/schema_definition/schema_elements/built_in_types.rb +103 -103
- data/lib/elastic_graph/schema_definition/schema_elements/field.rb +95 -55
- data/lib/elastic_graph/schema_definition/schema_elements/scalar_type.rb +19 -1
- data/lib/elastic_graph/schema_definition/schema_elements/type_namer.rb +1 -0
- data/lib/elastic_graph/schema_definition/schema_elements/type_reference.rb +9 -3
- data/lib/elastic_graph/schema_definition/schema_elements/type_with_subfields.rb +6 -0
- data/lib/elastic_graph/schema_definition/scripting/scripts/update/index_data.painless +2 -22
- data/lib/elastic_graph/schema_definition/state.rb +1 -2
- metadata +31 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2df8cb5a519f1210397de38c6400bb7bbe8ee9f9cdec00c7bc3cb42a774b0b12
|
4
|
+
data.tar.gz: 8217dffbed272a98a731ecac27306b3618aedcbfd0a644ff2baaafcc54b1ca2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0924aaa26ccb012d51b22208e7c5184b2d9f7c5003c7d405aa2afa189e316a2c11c1075e096ebbad24c951ef611546c8ec8ec358a54fd47c69bfd3747abede1f'
|
7
|
+
data.tar.gz: '091641a18d8483b84c2fb095f1152a310015559fa1a1ae4ae5fcba14bd34db9e7faf86c21a7c15c1f6d6197dd091a7f0408a4ee141a3dc53b2a3e8cf89bd80e1'
|
data/README.md
CHANGED
@@ -5,3 +5,44 @@ generate ElasticGraph's schema artifacts.
|
|
5
5
|
|
6
6
|
This gem is not intended to be used in production--production should
|
7
7
|
just use the schema artifacts instead.
|
8
|
+
|
9
|
+
## Dependency Diagram
|
10
|
+
|
11
|
+
```mermaid
|
12
|
+
graph LR;
|
13
|
+
classDef targetGemStyle fill:#FADBD8,stroke:#EC7063,color:#000,stroke-width:2px;
|
14
|
+
classDef otherEgGemStyle fill:#A9DFBF,stroke:#2ECC71,color:#000;
|
15
|
+
classDef externalGemStyle fill:#E0EFFF,stroke:#70A1D7,color:#2980B9;
|
16
|
+
elasticgraph-schema_definition["elasticgraph-schema_definition"];
|
17
|
+
class elasticgraph-schema_definition targetGemStyle;
|
18
|
+
elasticgraph-graphql["elasticgraph-graphql"];
|
19
|
+
elasticgraph-schema_definition --> elasticgraph-graphql;
|
20
|
+
class elasticgraph-graphql otherEgGemStyle;
|
21
|
+
elasticgraph-indexer["elasticgraph-indexer"];
|
22
|
+
elasticgraph-schema_definition --> elasticgraph-indexer;
|
23
|
+
class elasticgraph-indexer otherEgGemStyle;
|
24
|
+
elasticgraph-json_schema["elasticgraph-json_schema"];
|
25
|
+
elasticgraph-schema_definition --> elasticgraph-json_schema;
|
26
|
+
class elasticgraph-json_schema otherEgGemStyle;
|
27
|
+
elasticgraph-schema_artifacts["elasticgraph-schema_artifacts"];
|
28
|
+
elasticgraph-schema_definition --> elasticgraph-schema_artifacts;
|
29
|
+
class elasticgraph-schema_artifacts otherEgGemStyle;
|
30
|
+
elasticgraph-support["elasticgraph-support"];
|
31
|
+
elasticgraph-schema_definition --> elasticgraph-support;
|
32
|
+
class elasticgraph-support otherEgGemStyle;
|
33
|
+
graphql["graphql"];
|
34
|
+
elasticgraph-schema_definition --> graphql;
|
35
|
+
class graphql externalGemStyle;
|
36
|
+
graphql-c_parser["graphql-c_parser"];
|
37
|
+
elasticgraph-schema_definition --> graphql-c_parser;
|
38
|
+
class graphql-c_parser externalGemStyle;
|
39
|
+
rake["rake"];
|
40
|
+
elasticgraph-schema_definition --> rake;
|
41
|
+
class rake externalGemStyle;
|
42
|
+
elasticgraph-local["elasticgraph-local"];
|
43
|
+
elasticgraph-local --> elasticgraph-schema_definition;
|
44
|
+
class elasticgraph-local otherEgGemStyle;
|
45
|
+
click graphql href "https://rubygems.org/gems/graphql" "Open on RubyGems.org" _blank;
|
46
|
+
click graphql-c_parser href "https://rubygems.org/gems/graphql-c_parser" "Open on RubyGems.org" _blank;
|
47
|
+
click rake href "https://rubygems.org/gems/rake" "Open on RubyGems.org" _blank;
|
48
|
+
```
|
@@ -433,6 +433,8 @@ module ElasticGraph
|
|
433
433
|
|
434
434
|
def edge_type_for(type_name)
|
435
435
|
type_ref = @state.type_ref(type_name)
|
436
|
+
object_type = type_ref.as_object_type # : SchemaElements::ObjectType
|
437
|
+
|
436
438
|
new_object_type type_ref.as_edge.name do |t|
|
437
439
|
t.relay_pagination_type = true
|
438
440
|
t.resolve_fields_with :object_without_lookahead
|
@@ -440,7 +442,7 @@ module ElasticGraph
|
|
440
442
|
|
441
443
|
t.documentation <<~EOS
|
442
444
|
Represents a specific `#{type_name}` in the context of a `#{type_ref.as_connection.name}`,
|
443
|
-
providing access to both the `#{type_name}` and
|
445
|
+
providing access to both the `#{type_name}` and query-specific information such as the pagination `Cursor`.
|
444
446
|
|
445
447
|
See the [Relay GraphQL Cursor Connections
|
446
448
|
Specification](https://relay.dev/graphql/connections.htm#sec-Edge-Types) for more info.
|
@@ -456,6 +458,18 @@ module ElasticGraph
|
|
456
458
|
a `before` or `after` argument to continue paginating from this `#{type_name}`.
|
457
459
|
EOS
|
458
460
|
end
|
461
|
+
|
462
|
+
if object_type&.indexed?
|
463
|
+
t.field @state.schema_elements.all_highlights, "[SearchHighlight!]!" do |f|
|
464
|
+
f.documentation "All search highlights for this `#{type_name}`, indicating where in the indexed document the query matched."
|
465
|
+
end
|
466
|
+
|
467
|
+
if object_type.supports?(&:highlightable?)
|
468
|
+
t.field @state.schema_elements.highlights, type_ref.as_highlights.name do |f|
|
469
|
+
f.documentation "Specific search highlights for this `#{type_name}`, providing matching snippets for the requested fields."
|
470
|
+
end
|
471
|
+
end
|
472
|
+
end
|
459
473
|
end
|
460
474
|
end
|
461
475
|
|
@@ -80,8 +80,8 @@ module ElasticGraph
|
|
80
80
|
# @return [void]
|
81
81
|
# @see API#register_graphql_resolver
|
82
82
|
def resolve_fields_with(default_resolver_name, **config)
|
83
|
-
@default_graphql_resolver = default_resolver_name&.then do
|
84
|
-
SchemaArtifacts::RuntimeMetadata::ConfiguredGraphQLResolver.new(
|
83
|
+
@default_graphql_resolver = default_resolver_name&.then do
|
84
|
+
SchemaArtifacts::RuntimeMetadata::ConfiguredGraphQLResolver.new(it, config)
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
@@ -70,7 +70,8 @@ module ElasticGraph
|
|
70
70
|
build_aggregation_sub_aggregations_types + [
|
71
71
|
indexed_agg_type,
|
72
72
|
to_grouped_by_type,
|
73
|
-
to_aggregated_values_type
|
73
|
+
to_aggregated_values_type,
|
74
|
+
to_highlights_type
|
74
75
|
].compact
|
75
76
|
end
|
76
77
|
|
@@ -263,6 +264,20 @@ module ElasticGraph
|
|
263
264
|
end
|
264
265
|
end
|
265
266
|
|
267
|
+
def to_highlights_type
|
268
|
+
# If the type uses a custom mapping type we don't know how it can be highlighted, so we assume it needs no highlights type.
|
269
|
+
return nil if does_not_support?(&:highlightable?)
|
270
|
+
|
271
|
+
new_non_empty_object_type type_ref.as_highlights.name do |t|
|
272
|
+
t.documentation "Type used to request desired `#{name}` search highlight fields."
|
273
|
+
t.resolve_fields_with :get_record_field_value
|
274
|
+
|
275
|
+
graphql_fields_by_name.values.each do |field|
|
276
|
+
field.define_highlights_field(t)
|
277
|
+
end
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
266
281
|
def new_non_empty_object_type(name, &block)
|
267
282
|
type = schema_def_state.factory.new_object_type(name, &block)
|
268
283
|
type unless type.graphql_fields_by_name.empty?
|
@@ -109,15 +109,9 @@ module ElasticGraph
|
|
109
109
|
# ElasticGraph defines these enum types. Most of these are intended for usage as an _input_
|
110
110
|
# argument, but they could be used as a return type in your schema if they meet your needs.
|
111
111
|
#
|
112
|
-
# DateGroupingGranularity
|
113
|
-
# : Enumerates the supported granularities of a `Date`.
|
114
|
-
#
|
115
112
|
# DateGroupingTruncationUnit
|
116
113
|
# : Enumerates the supported truncation units of a `Date`.
|
117
114
|
#
|
118
|
-
# DateTimeGroupingGranularity
|
119
|
-
# : Enumerates the supported granularities of a `DateTime`.
|
120
|
-
#
|
121
115
|
# DateTimeGroupingTruncationUnit
|
122
116
|
# : Enumerates the supported truncation units of a `DateTime`.
|
123
117
|
#
|
@@ -157,6 +151,9 @@ module ElasticGraph
|
|
157
151
|
# `PageInfo` specification from the [Relay GraphQL Cursor Connections
|
158
152
|
# Specification](https://relay.dev/graphql/connections.htm#sec-undefined.PageInfo).
|
159
153
|
#
|
154
|
+
# SearchHighlight
|
155
|
+
# : Provides information about why a document matched a search via highlighted snippets.
|
156
|
+
#
|
160
157
|
# @!attribute [rw] schema_def_api
|
161
158
|
# @private
|
162
159
|
# @!attribute [rw] schema_def_state
|
@@ -206,23 +203,6 @@ module ElasticGraph
|
|
206
203
|
def register_standard_elastic_graph_types
|
207
204
|
# This is a special filter on a `String` type, so we don't have a `Text` scalar to generate it from.
|
208
205
|
schema_def_state.factory.build_standard_filter_input_types_for_index_leaf_type("String", name_prefix: "Text") do |t|
|
209
|
-
# We can't support filtering on `null` within a list, so make the field non-nullable when it's the
|
210
|
-
# `ListElementFilterInput` type. See scalar_type.rb for a larger comment explaining the rationale behind this.
|
211
|
-
equal_to_any_of_type = t.type_ref.list_element_filter_input? ? "[String!]" : "[String]"
|
212
|
-
t.field names.equal_to_any_of, equal_to_any_of_type do |f|
|
213
|
-
f.documentation ScalarType::EQUAL_TO_ANY_OF_DOC
|
214
|
-
end
|
215
|
-
|
216
|
-
t.field names.matches, "String" do |f|
|
217
|
-
f.documentation <<~EOS
|
218
|
-
Matches records where the field value matches the provided value using full text search.
|
219
|
-
|
220
|
-
When `null` is passed, matches all documents.
|
221
|
-
EOS
|
222
|
-
|
223
|
-
f.directive "deprecated", reason: "Use `#{names.matches_query}` instead."
|
224
|
-
end
|
225
|
-
|
226
206
|
t.field names.matches_query, schema_def_state.type_ref("MatchesQuery").as_filter_input.name do |f|
|
227
207
|
f.documentation <<~EOS
|
228
208
|
Matches records where the field value matches the provided query using full text search.
|
@@ -300,7 +280,71 @@ module ElasticGraph
|
|
300
280
|
f.documentation "The input phrase to search for."
|
301
281
|
end
|
302
282
|
|
303
|
-
# any_of/all_of/not don't really make sense on this filter because it doesn't make
|
283
|
+
# any_of/all_of/not don't really make sense on this filter because it doesn't make sense
|
284
|
+
# to apply an OR operator or negation to the fields of this type since they are all an
|
285
|
+
# indivisible part of a single filter operation on a specific field. So we remove them
|
286
|
+
# here.
|
287
|
+
remove_any_of_and_all_of_and_not_filter_operators_on(t)
|
288
|
+
end
|
289
|
+
|
290
|
+
register_filter "StringContains" do |t|
|
291
|
+
t.documentation <<~EOS
|
292
|
+
Input type used to specify parameters for the `#{names.contains}` string filtering operator.
|
293
|
+
|
294
|
+
When `null` is passed, matches all documents.
|
295
|
+
EOS
|
296
|
+
|
297
|
+
t.field names.any_substring_of, "[String!]" do |f|
|
298
|
+
f.documentation <<~EOS
|
299
|
+
Matches records where the field value contains one or more of the provided substrings.
|
300
|
+
|
301
|
+
When `null` is passed, matches all documents. When an empty list is passed,
|
302
|
+
this part of the filter matches no documents.
|
303
|
+
EOS
|
304
|
+
end
|
305
|
+
|
306
|
+
t.field names.all_substrings_of, "[String!]" do |f|
|
307
|
+
f.documentation <<~EOS
|
308
|
+
Matches records where the field value contains all of the provided substrings.
|
309
|
+
|
310
|
+
When `null` is passed or an empty list is passed, matches all documents.
|
311
|
+
EOS
|
312
|
+
end
|
313
|
+
|
314
|
+
t.field names.ignore_case, "Boolean!" do |f|
|
315
|
+
f.default false
|
316
|
+
f.documentation "Determines if the substring matching is case-sensitive (the default) or case-insensitive."
|
317
|
+
end
|
318
|
+
|
319
|
+
# any_of/all_of/not don't really make sense on this filter because it doesn't make sense
|
320
|
+
# to apply an OR operator or negation to the fields of this type since they are all an
|
321
|
+
# indivisible part of a single filter operation on a specific field. So we remove them
|
322
|
+
# here.
|
323
|
+
remove_any_of_and_all_of_and_not_filter_operators_on(t)
|
324
|
+
end
|
325
|
+
|
326
|
+
register_filter "StringStartsWith" do |t|
|
327
|
+
t.documentation <<~EOS
|
328
|
+
Input type used to specify parameters for the `#{names.starts_with}` string filtering operator.
|
329
|
+
|
330
|
+
When `null` is passed, matches all documents.
|
331
|
+
EOS
|
332
|
+
|
333
|
+
t.field names.any_prefix_of, "[String!]" do |f|
|
334
|
+
f.documentation <<~EOS
|
335
|
+
Matches records where the field value starts with one or more of the provided prefixes.
|
336
|
+
|
337
|
+
When `null` is passed, matches all documents. When an empty list is passed,
|
338
|
+
this part of the filter matches no documents.
|
339
|
+
EOS
|
340
|
+
end
|
341
|
+
|
342
|
+
t.field names.ignore_case, "Boolean!" do |f|
|
343
|
+
f.default false
|
344
|
+
f.documentation "Determines if the prefix matching is case-sensitive (the default) or case-insensitive."
|
345
|
+
end
|
346
|
+
|
347
|
+
# any_of/all_of/not don't really make sense on this filter because it doesn't make sense
|
304
348
|
# to apply an OR operator or negation to the fields of this type since they are all an
|
305
349
|
# indivisible part of a single filter operation on a specific field. So we remove them
|
306
350
|
# here.
|
@@ -425,6 +469,23 @@ module ElasticGraph
|
|
425
469
|
end
|
426
470
|
end
|
427
471
|
|
472
|
+
register_framework_object_type "SearchHighlight" do |t|
|
473
|
+
t.resolve_fields_with :object_without_lookahead
|
474
|
+
|
475
|
+
t.documentation "Provides information about why a document matched a search via highlighted snippets."
|
476
|
+
|
477
|
+
t.field names.path, "[String!]!" do |f|
|
478
|
+
f.documentation <<~EOS
|
479
|
+
Path to a leaf field containing one or more search highlight snippets. The returned list will contain a path segment for
|
480
|
+
each object layer of the schema, from the document root.
|
481
|
+
EOS
|
482
|
+
end
|
483
|
+
|
484
|
+
t.field names.snippets, "[String!]!" do |f|
|
485
|
+
f.documentation "List of snippets containing search highlights from field values at this `path`."
|
486
|
+
end
|
487
|
+
end
|
488
|
+
|
428
489
|
schema_def_api.factory.new_input_type("DateTimeGroupingOffsetInput") do |t|
|
429
490
|
t.documentation <<~EOS
|
430
491
|
Input type offered when grouping on `DateTime` fields, representing the amount of offset
|
@@ -619,6 +680,24 @@ module ElasticGraph
|
|
619
680
|
schema_def_api.scalar_type "String" do |t|
|
620
681
|
t.mapping type: "keyword"
|
621
682
|
t.json_schema type: "string"
|
683
|
+
|
684
|
+
t.customize_filter_input_type do |fit|
|
685
|
+
fit.field names.contains, schema_def_state.type_ref("StringContains").as_filter_input.name do |f|
|
686
|
+
f.documentation <<~EOS
|
687
|
+
Matches documents using substring filtering.
|
688
|
+
|
689
|
+
When `null` is passed, matches all documents.
|
690
|
+
EOS
|
691
|
+
end
|
692
|
+
|
693
|
+
fit.field names.starts_with, schema_def_state.type_ref("StringStartsWith").as_filter_input.name do |f|
|
694
|
+
f.documentation <<~EOS
|
695
|
+
Matches documents using prefix filtering.
|
696
|
+
|
697
|
+
When `null` is passed, matches all documents.
|
698
|
+
EOS
|
699
|
+
end
|
700
|
+
end
|
622
701
|
end
|
623
702
|
end
|
624
703
|
|
@@ -953,38 +1032,6 @@ module ElasticGraph
|
|
953
1032
|
# elasticgraph-graphql/spec/acceptance/elasticgraph_graphql_spec.rb
|
954
1033
|
es_first_day_of_week = "Monday"
|
955
1034
|
|
956
|
-
# TODO: Drop support for legacy grouping schema
|
957
|
-
schema_def_api.enum_type "DateGroupingGranularity" do |t|
|
958
|
-
t.documentation <<~EOS
|
959
|
-
Enumerates the supported granularities of a `Date`.
|
960
|
-
EOS
|
961
|
-
|
962
|
-
t.value "YEAR" do |v|
|
963
|
-
v.documentation "The year a `Date` falls in."
|
964
|
-
v.update_runtime_metadata datastore_value: "year"
|
965
|
-
end
|
966
|
-
|
967
|
-
t.value "QUARTER" do |v|
|
968
|
-
v.documentation "The quarter a `Date` falls in."
|
969
|
-
v.update_runtime_metadata datastore_value: "quarter"
|
970
|
-
end
|
971
|
-
|
972
|
-
t.value "MONTH" do |v|
|
973
|
-
v.documentation "The month a `Date` falls in."
|
974
|
-
v.update_runtime_metadata datastore_value: "month"
|
975
|
-
end
|
976
|
-
|
977
|
-
t.value "WEEK" do |v|
|
978
|
-
v.documentation "The week, beginning on #{es_first_day_of_week}, a `Date` falls in."
|
979
|
-
v.update_runtime_metadata datastore_value: "week"
|
980
|
-
end
|
981
|
-
|
982
|
-
t.value "DAY" do |v|
|
983
|
-
v.documentation "The exact day of a `Date`."
|
984
|
-
v.update_runtime_metadata datastore_value: "day"
|
985
|
-
end
|
986
|
-
end
|
987
|
-
|
988
1035
|
schema_def_api.enum_type "DateGroupingTruncationUnit" do |t|
|
989
1036
|
t.documentation <<~EOS
|
990
1037
|
Enumerates the supported truncation units of a `Date`.
|
@@ -1016,53 +1063,6 @@ module ElasticGraph
|
|
1016
1063
|
end
|
1017
1064
|
end
|
1018
1065
|
|
1019
|
-
# TODO: Drop support for legacy grouping schema
|
1020
|
-
schema_def_api.enum_type "DateTimeGroupingGranularity" do |t|
|
1021
|
-
t.documentation <<~EOS
|
1022
|
-
Enumerates the supported granularities of a `DateTime`.
|
1023
|
-
EOS
|
1024
|
-
|
1025
|
-
t.value "YEAR" do |v|
|
1026
|
-
v.documentation "The year a `DateTime` falls in."
|
1027
|
-
v.update_runtime_metadata datastore_value: "year"
|
1028
|
-
end
|
1029
|
-
|
1030
|
-
t.value "QUARTER" do |v|
|
1031
|
-
v.documentation "The quarter a `DateTime` falls in."
|
1032
|
-
v.update_runtime_metadata datastore_value: "quarter"
|
1033
|
-
end
|
1034
|
-
|
1035
|
-
t.value "MONTH" do |v|
|
1036
|
-
v.documentation "The month a `DateTime` falls in."
|
1037
|
-
v.update_runtime_metadata datastore_value: "month"
|
1038
|
-
end
|
1039
|
-
|
1040
|
-
t.value "WEEK" do |v|
|
1041
|
-
v.documentation "The week, beginning on #{es_first_day_of_week}, a `DateTime` falls in."
|
1042
|
-
v.update_runtime_metadata datastore_value: "week"
|
1043
|
-
end
|
1044
|
-
|
1045
|
-
t.value "DAY" do |v|
|
1046
|
-
v.documentation "The day a `DateTime` falls in."
|
1047
|
-
v.update_runtime_metadata datastore_value: "day"
|
1048
|
-
end
|
1049
|
-
|
1050
|
-
t.value "HOUR" do |v|
|
1051
|
-
v.documentation "The hour a `DateTime` falls in."
|
1052
|
-
v.update_runtime_metadata datastore_value: "hour"
|
1053
|
-
end
|
1054
|
-
|
1055
|
-
t.value "MINUTE" do |v|
|
1056
|
-
v.documentation "The minute a `DateTime` falls in."
|
1057
|
-
v.update_runtime_metadata datastore_value: "minute"
|
1058
|
-
end
|
1059
|
-
|
1060
|
-
t.value "SECOND" do |v|
|
1061
|
-
v.documentation "The second a `DateTime` falls in."
|
1062
|
-
v.update_runtime_metadata datastore_value: "second"
|
1063
|
-
end
|
1064
|
-
end
|
1065
|
-
|
1066
1066
|
schema_def_api.enum_type "DateTimeGroupingTruncationUnit" do |t|
|
1067
1067
|
t.documentation <<~EOS
|
1068
1068
|
Enumerates the supported truncation units of a `DateTime`.
|
@@ -53,6 +53,8 @@ module ElasticGraph
|
|
53
53
|
# @private
|
54
54
|
# @!attribute [rw] grouped_by_customizations
|
55
55
|
# @private
|
56
|
+
# @!attribute [rw] highlights_customizations
|
57
|
+
# @private
|
56
58
|
# @!attribute [rw] sub_aggregations_customizations
|
57
59
|
# @private
|
58
60
|
# @!attribute [rw] aggregated_values_customizations
|
@@ -69,6 +71,8 @@ module ElasticGraph
|
|
69
71
|
# @private
|
70
72
|
# @!attribute [rw] groupable
|
71
73
|
# @private
|
74
|
+
# @!attribute [rw] highlightable
|
75
|
+
# @private
|
72
76
|
# @!attribute [rw] source
|
73
77
|
# @private
|
74
78
|
# @!attribute [rw] runtime_field_script
|
@@ -83,15 +87,14 @@ module ElasticGraph
|
|
83
87
|
# @private
|
84
88
|
# @!attribute [rw] as_input
|
85
89
|
# @private
|
86
|
-
# @!attribute [rw] legacy_grouping_schema
|
87
|
-
# @private
|
88
90
|
class Field < Struct.new(
|
89
91
|
:name, :original_type, :parent_type, :original_type_for_derived_types, :schema_def_state, :accuracy_confidence,
|
90
|
-
:filter_customizations, :grouped_by_customizations, :sub_aggregations_customizations,
|
91
|
-
:aggregated_values_customizations, :sort_order_enum_value_customizations,
|
92
|
-
:
|
92
|
+
:filter_customizations, :grouped_by_customizations, :highlights_customizations, :sub_aggregations_customizations,
|
93
|
+
:aggregated_values_customizations, :sort_order_enum_value_customizations, :args,
|
94
|
+
:sortable, :filterable, :aggregatable, :groupable, :highlightable,
|
95
|
+
:graphql_only, :source, :runtime_field_script, :relationship, :singular_name,
|
93
96
|
:computation_detail, :non_nullable_in_json_schema, :as_input,
|
94
|
-
:
|
97
|
+
:name_in_index, :resolver
|
95
98
|
)
|
96
99
|
include Mixins::HasDocumentation
|
97
100
|
include Mixins::HasDirectives
|
@@ -103,8 +106,8 @@ module ElasticGraph
|
|
103
106
|
name:, type:, parent_type:, schema_def_state:,
|
104
107
|
accuracy_confidence: :high, name_in_index: name,
|
105
108
|
type_for_derived_types: nil, graphql_only: nil, singular: nil,
|
106
|
-
sortable: nil, filterable: nil, aggregatable: nil, groupable: nil,
|
107
|
-
as_input: false,
|
109
|
+
sortable: nil, filterable: nil, aggregatable: nil, groupable: nil, highlightable: nil,
|
110
|
+
as_input: false, resolver: nil
|
108
111
|
)
|
109
112
|
type_ref = schema_def_state.type_ref(type)
|
110
113
|
super(
|
@@ -116,6 +119,7 @@ module ElasticGraph
|
|
116
119
|
accuracy_confidence: accuracy_confidence,
|
117
120
|
filter_customizations: [],
|
118
121
|
grouped_by_customizations: [],
|
122
|
+
highlights_customizations: [],
|
119
123
|
sub_aggregations_customizations: [],
|
120
124
|
aggregated_values_customizations: [],
|
121
125
|
sort_order_enum_value_customizations: [],
|
@@ -124,6 +128,7 @@ module ElasticGraph
|
|
124
128
|
filterable: filterable,
|
125
129
|
aggregatable: aggregatable,
|
126
130
|
groupable: groupable,
|
131
|
+
highlightable: highlightable,
|
127
132
|
graphql_only: graphql_only,
|
128
133
|
source: nil,
|
129
134
|
runtime_field_script: nil,
|
@@ -134,7 +139,6 @@ module ElasticGraph
|
|
134
139
|
name_in_index: name_in_index,
|
135
140
|
non_nullable_in_json_schema: false,
|
136
141
|
as_input: as_input,
|
137
|
-
legacy_grouping_schema: legacy_grouping_schema,
|
138
142
|
resolver: resolver
|
139
143
|
)
|
140
144
|
|
@@ -191,6 +195,7 @@ module ElasticGraph
|
|
191
195
|
# @return [void]
|
192
196
|
# @see #customize_aggregated_values_field
|
193
197
|
# @see #customize_grouped_by_field
|
198
|
+
# @see #customize_highlights_field
|
194
199
|
# @see #customize_sort_order_enum_values
|
195
200
|
# @see #customize_sub_aggregations_field
|
196
201
|
# @see #on_each_generated_schema_element
|
@@ -223,6 +228,7 @@ module ElasticGraph
|
|
223
228
|
# @return [void]
|
224
229
|
# @see #customize_filter_field
|
225
230
|
# @see #customize_grouped_by_field
|
231
|
+
# @see #customize_highlights_field
|
226
232
|
# @see #customize_sort_order_enum_values
|
227
233
|
# @see #customize_sub_aggregations_field
|
228
234
|
# @see #on_each_generated_schema_element
|
@@ -255,6 +261,7 @@ module ElasticGraph
|
|
255
261
|
# @return [void]
|
256
262
|
# @see #customize_aggregated_values_field
|
257
263
|
# @see #customize_filter_field
|
264
|
+
# @see #customize_highlights_field
|
258
265
|
# @see #customize_sort_order_enum_values
|
259
266
|
# @see #customize_sub_aggregations_field
|
260
267
|
# @see #on_each_generated_schema_element
|
@@ -277,6 +284,39 @@ module ElasticGraph
|
|
277
284
|
grouped_by_customizations << customization_block
|
278
285
|
end
|
279
286
|
|
287
|
+
# @note For each field defined in your schema that is highlightable, a corresponding highlights field will be created on the
|
288
|
+
# `*Highlights` type derived from the parent object type.
|
289
|
+
#
|
290
|
+
# Registers a customization callback that will be applied to the corresponding highlights field that will be generated for this
|
291
|
+
# field.
|
292
|
+
#
|
293
|
+
# @yield [Field] derived highlights field
|
294
|
+
# @return [void]
|
295
|
+
# @see #customize_aggregated_values_field
|
296
|
+
# @see #customize_filter_field
|
297
|
+
# @see #customize_grouped_by_field
|
298
|
+
# @see #customize_sort_order_enum_values
|
299
|
+
# @see #customize_sub_aggregations_field
|
300
|
+
# @see #on_each_generated_schema_element
|
301
|
+
#
|
302
|
+
# @example Mark `CampaignHighlights.organizationId` with `@deprecated`
|
303
|
+
# ElasticGraph.define_schema do |schema|
|
304
|
+
# schema.object_type "Campaign" do |t|
|
305
|
+
# t.field "id", "ID"
|
306
|
+
#
|
307
|
+
# t.field "organizationId", "ID" do |f|
|
308
|
+
# f.customize_highlights_field do |gbf|
|
309
|
+
# gbf.directive "deprecated"
|
310
|
+
# end
|
311
|
+
# end
|
312
|
+
#
|
313
|
+
# t.index "campaigns"
|
314
|
+
# end
|
315
|
+
# end
|
316
|
+
def customize_highlights_field(&customization_block)
|
317
|
+
highlights_customizations << customization_block
|
318
|
+
end
|
319
|
+
|
280
320
|
# @note For each field defined in your schema that is sub-aggregatable (e.g. list fields indexed using the `nested` mapping type),
|
281
321
|
# a corresponding field will be created on the `*AggregationSubAggregations` type derived from the parent object type.
|
282
322
|
#
|
@@ -288,6 +328,7 @@ module ElasticGraph
|
|
288
328
|
# @see #customize_aggregated_values_field
|
289
329
|
# @see #customize_filter_field
|
290
330
|
# @see #customize_grouped_by_field
|
331
|
+
# @see #customize_highlights_field
|
291
332
|
# @see #customize_sort_order_enum_values
|
292
333
|
# @see #on_each_generated_schema_element
|
293
334
|
#
|
@@ -329,6 +370,7 @@ module ElasticGraph
|
|
329
370
|
# @see #customize_aggregated_values_field
|
330
371
|
# @see #customize_filter_field
|
331
372
|
# @see #customize_grouped_by_field
|
373
|
+
# @see #customize_highlights_field
|
332
374
|
# @see #customize_sub_aggregations_field
|
333
375
|
# @see #on_each_generated_schema_element
|
334
376
|
#
|
@@ -357,6 +399,8 @@ module ElasticGraph
|
|
357
399
|
# ask for values for the field in a response.
|
358
400
|
# * A {Field} may be generated on the `*FilterInput` {InputType} derived from the parent {ObjectType} or {InterfaceType}. This is
|
359
401
|
# used by clients to specify how the query should filter.
|
402
|
+
# * A {Field} may be generated on the `*Highlights` {ObjectType} derived from the parent {ObjectType} or {InterfaceType}. This is
|
403
|
+
# used by clients to request search highlights for a field.
|
360
404
|
# * A {Field} may be generated on the `*AggregationGroupedBy` {ObjectType} derived from the parent {ObjectType} or {InterfaceType}.
|
361
405
|
# This is used by clients to specify how aggregations should be grouped.
|
362
406
|
# * A {Field} may be generated on the `*AggregatedValues` {ObjectType} derived from the parent {ObjectType} or {InterfaceType}.
|
@@ -373,6 +417,7 @@ module ElasticGraph
|
|
373
417
|
# @see #customize_aggregated_values_field
|
374
418
|
# @see #customize_filter_field
|
375
419
|
# @see #customize_grouped_by_field
|
420
|
+
# @see #customize_highlights_field
|
376
421
|
# @see #customize_sort_order_enum_values
|
377
422
|
# @see #customize_sub_aggregations_field
|
378
423
|
#
|
@@ -381,15 +426,16 @@ module ElasticGraph
|
|
381
426
|
# schema.object_type "Transaction" do |t|
|
382
427
|
# t.field "id", "ID"
|
383
428
|
#
|
384
|
-
# t.field "
|
429
|
+
# t.field "currency", "String" do |f|
|
385
430
|
# f.on_each_generated_schema_element do |element|
|
386
|
-
# # Adds a `@deprecated` directive to every GraphQL schema element generated for `
|
431
|
+
# # Adds a `@deprecated` directive to every GraphQL schema element generated for `currency`:
|
387
432
|
# #
|
388
|
-
# # - The `Transaction.
|
389
|
-
# # - The `TransactionFilterInput.
|
390
|
-
# # - The `
|
391
|
-
# # - The `
|
392
|
-
# # - The `
|
433
|
+
# # - The `Transaction.currency` field.
|
434
|
+
# # - The `TransactionFilterInput.currency` field.
|
435
|
+
# # - The `TransactionHighlights.currency` field.
|
436
|
+
# # - The `TransactionAggregationGroupedBy.currency` field.
|
437
|
+
# # - The `TransactionAggregatedValues.currency` field.
|
438
|
+
# # - The `TransactionSortOrder.currency_ASC` and`TransactionSortOrder.currency_DESC` enum values.
|
393
439
|
# element.directive "deprecated"
|
394
440
|
# end
|
395
441
|
# end
|
@@ -402,6 +448,7 @@ module ElasticGraph
|
|
402
448
|
customize_filter_field(&customization_block)
|
403
449
|
customize_aggregated_values_field(&customization_block)
|
404
450
|
customize_grouped_by_field(&customization_block)
|
451
|
+
customize_highlights_field(&customization_block)
|
405
452
|
customize_sub_aggregations_field(&customization_block)
|
406
453
|
customize_sort_order_enum_values(&customization_block)
|
407
454
|
end
|
@@ -497,7 +544,7 @@ module ElasticGraph
|
|
497
544
|
# end
|
498
545
|
# end
|
499
546
|
def resolve_with(resolver_name, **config)
|
500
|
-
self.resolver = resolver_name&.then {
|
547
|
+
self.resolver = resolver_name&.then { SchemaArtifacts::RuntimeMetadata::ConfiguredGraphQLResolver.new(it, config) }
|
501
548
|
end
|
502
549
|
|
503
550
|
# @private
|
@@ -659,6 +706,17 @@ module ElasticGraph
|
|
659
706
|
nested? || type_for_derived_types.fully_unwrapped.as_object_type&.supports?(&:sub_aggregatable?)
|
660
707
|
end
|
661
708
|
|
709
|
+
# @private
|
710
|
+
HIGHLIGHTABLE_MAPPING_TYPES = %w[keyword text match_only_text]
|
711
|
+
|
712
|
+
def highlightable?
|
713
|
+
return highlightable unless highlightable.nil?
|
714
|
+
return false if relationship
|
715
|
+
return true if HIGHLIGHTABLE_MAPPING_TYPES.include?(mapping_type)
|
716
|
+
|
717
|
+
type_for_derived_types.fully_unwrapped.as_object_type&.supports?(&:highlightable?)
|
718
|
+
end
|
719
|
+
|
662
720
|
# Defines an argument on the field.
|
663
721
|
#
|
664
722
|
# @note ElasticGraph takes care of defining arguments for all the query features it supports, so there is generally no need to use
|
@@ -724,16 +782,32 @@ module ElasticGraph
|
|
724
782
|
parent_type.field field_name, grouped_by_field_type_name, name_in_index: name_in_index, graphql_only: true do |f|
|
725
783
|
add_grouped_by_field_documentation(f)
|
726
784
|
|
727
|
-
define_legacy_timestamp_grouping_arguments_if_needed(f) if legacy_grouping_schema
|
728
|
-
|
729
785
|
grouped_by_customizations.each { |block| block.call(f) }
|
730
786
|
end
|
731
787
|
end
|
732
788
|
|
789
|
+
# @private
|
790
|
+
def define_highlights_field(parent_type)
|
791
|
+
return unless highlightable?
|
792
|
+
|
793
|
+
unwrapped_type = type_for_derived_types.fully_unwrapped
|
794
|
+
type_name =
|
795
|
+
if unwrapped_type.leaf?
|
796
|
+
"[String!]!"
|
797
|
+
else
|
798
|
+
unwrapped_type.as_highlights.name
|
799
|
+
end
|
800
|
+
|
801
|
+
parent_type.field name, type_name, name_in_index: name_in_index, graphql_only: true do |f|
|
802
|
+
f.documentation derived_documentation("Search highlights for the `#{name}`, providing snippets of the matching text")
|
803
|
+
highlights_customizations.each { |block| block.call(f) }
|
804
|
+
end
|
805
|
+
end
|
806
|
+
|
733
807
|
# @private
|
734
808
|
def grouped_by_field_type_name
|
735
809
|
unwrapped_type = type_for_derived_types.fully_unwrapped
|
736
|
-
if unwrapped_type.scalar_type_needing_grouped_by_object?
|
810
|
+
if unwrapped_type.scalar_type_needing_grouped_by_object?
|
737
811
|
unwrapped_type.with_reverted_override.as_grouped_by.name
|
738
812
|
elsif unwrapped_type.leaf?
|
739
813
|
unwrapped_type.name
|
@@ -754,7 +828,7 @@ module ElasticGraph
|
|
754
828
|
"The `#{name}` field value for this group",
|
755
829
|
list_field_grouped_by_doc_note("the selected subfields of `#{name}`")
|
756
830
|
)
|
757
|
-
elsif type_for_derived_types.fully_unwrapped.scalar_type_needing_grouped_by_object?
|
831
|
+
elsif type_for_derived_types.fully_unwrapped.scalar_type_needing_grouped_by_object?
|
758
832
|
derived_documentation("Offers the different grouping options for the `#{name}` value within this group")
|
759
833
|
else
|
760
834
|
derived_documentation("The `#{name}` field value for this group")
|
@@ -1021,40 +1095,6 @@ module ElasticGraph
|
|
1021
1095
|
mapping_type == "text"
|
1022
1096
|
end
|
1023
1097
|
|
1024
|
-
def define_legacy_timestamp_grouping_arguments_if_needed(grouping_field)
|
1025
|
-
case type.fully_unwrapped.name
|
1026
|
-
when "Date"
|
1027
|
-
grouping_field.argument schema_def_state.schema_elements.granularity, "DateGroupingGranularity!" do |a|
|
1028
|
-
a.documentation "Determines the grouping granularity for this field."
|
1029
|
-
end
|
1030
|
-
|
1031
|
-
grouping_field.argument schema_def_state.schema_elements.offset_days, "Int" do |a|
|
1032
|
-
a.documentation <<~EOS
|
1033
|
-
Number of days (positive or negative) to shift the `Date` boundaries of each date grouping bucket.
|
1034
|
-
|
1035
|
-
For example, when grouping by `YEAR`, this can be used to align the buckets with fiscal or school years instead of calendar years.
|
1036
|
-
EOS
|
1037
|
-
end
|
1038
|
-
when "DateTime"
|
1039
|
-
grouping_field.argument schema_def_state.schema_elements.granularity, "DateTimeGroupingGranularity!" do |a|
|
1040
|
-
a.documentation "Determines the grouping granularity for this field."
|
1041
|
-
end
|
1042
|
-
|
1043
|
-
grouping_field.argument schema_def_state.schema_elements.time_zone, "TimeZone" do |a|
|
1044
|
-
a.documentation "The time zone to use when determining which grouping a `DateTime` value falls in."
|
1045
|
-
a.default "UTC"
|
1046
|
-
end
|
1047
|
-
|
1048
|
-
grouping_field.argument schema_def_state.schema_elements.offset, "DateTimeGroupingOffsetInput" do |a|
|
1049
|
-
a.documentation <<~EOS
|
1050
|
-
Amount of offset (positive or negative) to shift the `DateTime` boundaries of each grouping bucket.
|
1051
|
-
|
1052
|
-
For example, when grouping by `WEEK`, you can shift by 24 hours to change what day-of-week weeks are considered to start on.
|
1053
|
-
EOS
|
1054
|
-
end
|
1055
|
-
end
|
1056
|
-
end
|
1057
|
-
|
1058
1098
|
def list_field_grouped_by_doc_note(individual_value_selection_description)
|
1059
1099
|
<<~EOS.strip
|
1060
1100
|
Note: `#{name}` is a collection field, but selecting this field will group on individual values of #{individual_value_selection_description}.
|
@@ -39,7 +39,16 @@ module ElasticGraph
|
|
39
39
|
# @private
|
40
40
|
# @!attribute [rw] aggregated_values_customizations
|
41
41
|
# @private
|
42
|
-
|
42
|
+
# @!attribute [rw] filter_input_customizations
|
43
|
+
# @private
|
44
|
+
class ScalarType < Struct.new(
|
45
|
+
:schema_def_state,
|
46
|
+
:type_ref,
|
47
|
+
:mapping_type,
|
48
|
+
:runtime_metadata,
|
49
|
+
:aggregated_values_customizations,
|
50
|
+
:filter_input_customizations
|
51
|
+
)
|
43
52
|
# `Struct.new` provides the following methods:
|
44
53
|
# @dynamic type_ref, runtime_metadata
|
45
54
|
prepend Mixins::VerifiesGraphQLName
|
@@ -157,6 +166,13 @@ module ElasticGraph
|
|
157
166
|
self.aggregated_values_customizations = block
|
158
167
|
end
|
159
168
|
|
169
|
+
# Registers a block which will be used to customize the derived `*FilterInput` object type.
|
170
|
+
#
|
171
|
+
# @private
|
172
|
+
def customize_filter_input_type(&block)
|
173
|
+
self.filter_input_customizations = block
|
174
|
+
end
|
175
|
+
|
160
176
|
# @private
|
161
177
|
def aggregated_values_type
|
162
178
|
if aggregated_values_customizations
|
@@ -284,6 +300,8 @@ module ElasticGraph
|
|
284
300
|
f.documentation LTE_DOC
|
285
301
|
end
|
286
302
|
end
|
303
|
+
|
304
|
+
filter_input_customizations&.call(t)
|
287
305
|
end
|
288
306
|
end
|
289
307
|
|
@@ -147,6 +147,7 @@ module ElasticGraph
|
|
147
147
|
FieldsListFilterInput: "%{base}FieldsListFilterInput",
|
148
148
|
FilterInput: "%{base}FilterInput",
|
149
149
|
GroupedBy: "%{base}GroupedBy",
|
150
|
+
Highlights: "%{base}Highlights",
|
150
151
|
InputEnum: "%{base}Input",
|
151
152
|
ListElementFilterInput: "%{base}ListElementFilterInput",
|
152
153
|
ListFilterInput: "%{base}ListFilterInput",
|
@@ -108,8 +108,12 @@ module ElasticGraph
|
|
108
108
|
when :enum
|
109
109
|
true
|
110
110
|
else
|
111
|
-
|
112
|
-
|
111
|
+
if block_given?
|
112
|
+
yield
|
113
|
+
else
|
114
|
+
# If we can't determine the type from the name, just raise an error.
|
115
|
+
raise Errors::SchemaError, "Type `#{name}` cannot be resolved. Is it misspelled?"
|
116
|
+
end
|
113
117
|
end
|
114
118
|
end
|
115
119
|
|
@@ -287,6 +291,7 @@ module ElasticGraph
|
|
287
291
|
# @dynamic as_edge
|
288
292
|
# @dynamic as_fields_list_filter_input
|
289
293
|
# @dynamic as_filter_input
|
294
|
+
# @dynamic as_highlights
|
290
295
|
# @dynamic as_input_enum
|
291
296
|
# @dynamic as_list_element_filter_input, list_element_filter_input?
|
292
297
|
# @dynamic as_list_filter_input, list_filter_input?
|
@@ -338,7 +343,8 @@ module ElasticGraph
|
|
338
343
|
return :object if OBJECT_FORMATS.any? { |f| type_namer.matches_format?(name, f) }
|
339
344
|
|
340
345
|
if (as_output_enum_name = type_namer.extract_base_from(name, format: :InputEnum))
|
341
|
-
:enum if ENUM_FORMATS.any? { |f| type_namer.matches_format?(as_output_enum_name, f) }
|
346
|
+
return :enum if ENUM_FORMATS.any? { |f| type_namer.matches_format?(as_output_enum_name, f) }
|
347
|
+
:enum if as_output_enum_name != self.name && schema_def_state.type_ref(as_output_enum_name).enum? { false }
|
342
348
|
end
|
343
349
|
end
|
344
350
|
|
@@ -135,6 +135,8 @@ module ElasticGraph
|
|
135
135
|
# not provided, ElasticGraph will infer field groupability based on the field's GraphQL type and mapping type.
|
136
136
|
# @option options [Boolean] sortable force-enables or disables the ability for queries to sort by this field. When not provided,
|
137
137
|
# ElasticGraph will infer field sortability based on the field's GraphQL type and mapping type.
|
138
|
+
# @option options [Boolean] highlightable force-enables or disables the ability to request search highlights for this field. When
|
139
|
+
# not provided, ElasticGraph will infer field highlightable based on the field's mapping type.
|
138
140
|
# @yield [Field] the field for further customization
|
139
141
|
# @return [void]
|
140
142
|
#
|
@@ -285,6 +287,8 @@ module ElasticGraph
|
|
285
287
|
# ElasticGraph will infer field filterability based on the field's GraphQL type and mapping type.
|
286
288
|
# @param groupable [Boolean] force-enables or disables the ability for aggregation queries to group by this field. When
|
287
289
|
# not provided, ElasticGraph will infer field groupability based on the field's GraphQL type and mapping type.
|
290
|
+
# @param highlightable [Boolean] force-enables or disables the ability to request search highlights for this field. When
|
291
|
+
# not provided, ElasticGraph will infer field highlightable based on the field's mapping type.
|
288
292
|
# @yield [Field] the field for further customization
|
289
293
|
# @return [void]
|
290
294
|
#
|
@@ -310,6 +314,7 @@ module ElasticGraph
|
|
310
314
|
groupable: !!singular,
|
311
315
|
filterable: nil,
|
312
316
|
aggregatable: nil,
|
317
|
+
highlightable: nil,
|
313
318
|
&block
|
314
319
|
)
|
315
320
|
element_type_ref = schema_def_state.type_ref(element_type).to_final_form
|
@@ -331,6 +336,7 @@ module ElasticGraph
|
|
331
336
|
groupable: groupable,
|
332
337
|
filterable: filterable,
|
333
338
|
aggregatable: aggregatable,
|
339
|
+
highlightable: highlightable,
|
334
340
|
sortable: false
|
335
341
|
) do |f|
|
336
342
|
f.define_relay_pagination_arguments!
|
@@ -31,30 +31,10 @@ if (previousSourceIdsForRelationship.size() > 0) {
|
|
31
31
|
);
|
32
32
|
}
|
33
33
|
|
34
|
-
|
35
|
-
// we need to continue getting it from `__sourceVersions`. Both our old version and this versions of this
|
36
|
-
// script keep the value in `__sourceVersions` up-to-date, whereas the old script only writes it to
|
37
|
-
// `__sourceVersions`. Until we have completely migrated off of the old script for all ElasticGraph
|
38
|
-
// clusters, we need to keep using it.
|
39
|
-
//
|
40
|
-
// Later, after the old script is no longer used by any clusters, we'll stop using `__sourceVersions`.
|
41
|
-
Number _versionForSourceType = source.get("__sourceVersions")?.get(params.sourceType)?.get(sourceId);
|
42
|
-
Number _versionForRelationship = relationshipVersionsMap.get(sourceId);
|
34
|
+
Number maybeDocVersion = source.__versions.get(params.relationship)?.get(params.sourceId);
|
43
35
|
|
44
36
|
// Our JSON schema requires event versions to be non-negative, so we can safely use Long.MIN_VALUE as a stand-in when the value is null.
|
45
|
-
long
|
46
|
-
long versionForRelationship = _versionForRelationship == null ? Long.MIN_VALUE : _versionForRelationship.longValue();
|
47
|
-
|
48
|
-
// Pick the larger of the two versions as our doc version. Note that `Math.max` didn't work for me here for
|
49
|
-
// reasons I don't understand, but a simple ternary works fine.
|
50
|
-
//
|
51
|
-
// In theory, we could just use `versionForSourceType` as the `docVersion` (and not even check `__versions` at all)
|
52
|
-
// since both the old version and this version maintain the doc version in `__sourceVersions`. However, that would
|
53
|
-
// prevent this version of the script from being forward-compatible with the planned next version of this script.
|
54
|
-
// In the next version, we plan to stop writing to `__sourceVersions`, and as we can't deploy that change atomically,
|
55
|
-
// this version of the script will continue to run after that has begun to be used. So this version of the script
|
56
|
-
// must consider which version is greater here, and not simply trust either version value.
|
57
|
-
long docVersion = versionForSourceType > versionForRelationship ? versionForSourceType : versionForRelationship;
|
37
|
+
long docVersion = maybeDocVersion == null ? Long.MIN_VALUE : maybeDocVersion.longValue();
|
58
38
|
|
59
39
|
if (docVersion >= eventVersion) {
|
60
40
|
throw new IllegalArgumentException("ElasticGraph update was a no-op: [" +
|
@@ -173,8 +173,7 @@ module ElasticGraph
|
|
173
173
|
raise Errors::SchemaError, "Cannot access `user_defined_field_references_by_type_name` until the schema definition is complete."
|
174
174
|
end
|
175
175
|
|
176
|
-
|
177
|
-
.group_by { |f| f.type.fully_unwrapped.name }
|
176
|
+
user_defined_fields.group_by { |f| f.type.fully_unwrapped.name }
|
178
177
|
end
|
179
178
|
end
|
180
179
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticgraph-schema_definition
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Myron Marston
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
- Block Engineering
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: elasticgraph-graphql
|
@@ -17,84 +17,84 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - '='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.
|
20
|
+
version: 1.0.0.rc2
|
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: 0.
|
27
|
+
version: 1.0.0.rc2
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: elasticgraph-indexer
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - '='
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.
|
34
|
+
version: 1.0.0.rc2
|
35
35
|
type: :runtime
|
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: 0.
|
41
|
+
version: 1.0.0.rc2
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: elasticgraph-json_schema
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - '='
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 0.
|
48
|
+
version: 1.0.0.rc2
|
49
49
|
type: :runtime
|
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: 0.
|
55
|
+
version: 1.0.0.rc2
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: elasticgraph-schema_artifacts
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - '='
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 0.
|
62
|
+
version: 1.0.0.rc2
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - '='
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.
|
69
|
+
version: 1.0.0.rc2
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: elasticgraph-support
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - '='
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: 0.
|
76
|
+
version: 1.0.0.rc2
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - '='
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: 0.
|
83
|
+
version: 1.0.0.rc2
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: graphql
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: 2.5.
|
90
|
+
version: 2.5.10
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: 2.5.
|
97
|
+
version: 2.5.10
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: graphql-c_parser
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,7 +104,7 @@ dependencies:
|
|
104
104
|
version: '1.1'
|
105
105
|
- - ">="
|
106
106
|
- !ruby/object:Gem::Version
|
107
|
-
version: 1.1.
|
107
|
+
version: 1.1.3
|
108
108
|
type: :runtime
|
109
109
|
prerelease: false
|
110
110
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -114,83 +114,77 @@ dependencies:
|
|
114
114
|
version: '1.1'
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.1.
|
117
|
+
version: 1.1.3
|
118
118
|
- !ruby/object:Gem::Dependency
|
119
119
|
name: rake
|
120
120
|
requirement: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '13.
|
125
|
-
- - ">="
|
126
|
-
- !ruby/object:Gem::Version
|
127
|
-
version: 13.2.1
|
124
|
+
version: '13.3'
|
128
125
|
type: :runtime
|
129
126
|
prerelease: false
|
130
127
|
version_requirements: !ruby/object:Gem::Requirement
|
131
128
|
requirements:
|
132
129
|
- - "~>"
|
133
130
|
- !ruby/object:Gem::Version
|
134
|
-
version: '13.
|
135
|
-
- - ">="
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
version: 13.2.1
|
131
|
+
version: '13.3'
|
138
132
|
- !ruby/object:Gem::Dependency
|
139
133
|
name: elasticgraph-admin
|
140
134
|
requirement: !ruby/object:Gem::Requirement
|
141
135
|
requirements:
|
142
136
|
- - '='
|
143
137
|
- !ruby/object:Gem::Version
|
144
|
-
version: 0.
|
138
|
+
version: 1.0.0.rc2
|
145
139
|
type: :development
|
146
140
|
prerelease: false
|
147
141
|
version_requirements: !ruby/object:Gem::Requirement
|
148
142
|
requirements:
|
149
143
|
- - '='
|
150
144
|
- !ruby/object:Gem::Version
|
151
|
-
version: 0.
|
145
|
+
version: 1.0.0.rc2
|
152
146
|
- !ruby/object:Gem::Dependency
|
153
147
|
name: elasticgraph-datastore_core
|
154
148
|
requirement: !ruby/object:Gem::Requirement
|
155
149
|
requirements:
|
156
150
|
- - '='
|
157
151
|
- !ruby/object:Gem::Version
|
158
|
-
version: 0.
|
152
|
+
version: 1.0.0.rc2
|
159
153
|
type: :development
|
160
154
|
prerelease: false
|
161
155
|
version_requirements: !ruby/object:Gem::Requirement
|
162
156
|
requirements:
|
163
157
|
- - '='
|
164
158
|
- !ruby/object:Gem::Version
|
165
|
-
version: 0.
|
159
|
+
version: 1.0.0.rc2
|
166
160
|
- !ruby/object:Gem::Dependency
|
167
161
|
name: elasticgraph-elasticsearch
|
168
162
|
requirement: !ruby/object:Gem::Requirement
|
169
163
|
requirements:
|
170
164
|
- - '='
|
171
165
|
- !ruby/object:Gem::Version
|
172
|
-
version: 0.
|
166
|
+
version: 1.0.0.rc2
|
173
167
|
type: :development
|
174
168
|
prerelease: false
|
175
169
|
version_requirements: !ruby/object:Gem::Requirement
|
176
170
|
requirements:
|
177
171
|
- - '='
|
178
172
|
- !ruby/object:Gem::Version
|
179
|
-
version: 0.
|
173
|
+
version: 1.0.0.rc2
|
180
174
|
- !ruby/object:Gem::Dependency
|
181
175
|
name: elasticgraph-opensearch
|
182
176
|
requirement: !ruby/object:Gem::Requirement
|
183
177
|
requirements:
|
184
178
|
- - '='
|
185
179
|
- !ruby/object:Gem::Version
|
186
|
-
version: 0.
|
180
|
+
version: 1.0.0.rc2
|
187
181
|
type: :development
|
188
182
|
prerelease: false
|
189
183
|
version_requirements: !ruby/object:Gem::Requirement
|
190
184
|
requirements:
|
191
185
|
- - '='
|
192
186
|
- !ruby/object:Gem::Version
|
193
|
-
version: 0.
|
187
|
+
version: 1.0.0.rc2
|
194
188
|
email:
|
195
189
|
- myron@squareup.com
|
196
190
|
executables: []
|
@@ -275,10 +269,10 @@ licenses:
|
|
275
269
|
- MIT
|
276
270
|
metadata:
|
277
271
|
bug_tracker_uri: https://github.com/block/elasticgraph/issues
|
278
|
-
changelog_uri: https://github.com/block/elasticgraph/releases/tag/
|
279
|
-
documentation_uri: https://block.github.io/elasticgraph/api-docs/
|
272
|
+
changelog_uri: https://github.com/block/elasticgraph/releases/tag/v1.0.0.rc2
|
273
|
+
documentation_uri: https://block.github.io/elasticgraph/api-docs/v1.0.0.rc2/
|
280
274
|
homepage_uri: https://block.github.io/elasticgraph/
|
281
|
-
source_code_uri: https://github.com/block/elasticgraph/tree/
|
275
|
+
source_code_uri: https://github.com/block/elasticgraph/tree/v1.0.0.rc2/elasticgraph-schema_definition
|
282
276
|
gem_category: local
|
283
277
|
rdoc_options: []
|
284
278
|
require_paths:
|
@@ -287,7 +281,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
287
281
|
requirements:
|
288
282
|
- - ">="
|
289
283
|
- !ruby/object:Gem::Version
|
290
|
-
version: '3.
|
284
|
+
version: '3.4'
|
291
285
|
- - "<"
|
292
286
|
- !ruby/object:Gem::Version
|
293
287
|
version: '3.5'
|
@@ -297,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
297
291
|
- !ruby/object:Gem::Version
|
298
292
|
version: '0'
|
299
293
|
requirements: []
|
300
|
-
rubygems_version: 3.6.
|
294
|
+
rubygems_version: 3.6.7
|
301
295
|
specification_version: 4
|
302
296
|
summary: ElasticGraph gem that provides the schema definition API and generates schema
|
303
297
|
artifacts.
|