elasticgraph-schema_definition 0.19.3.1 → 1.0.0.rc1

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.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/lib/elastic_graph/schema_definition/api.rb +5 -12
  4. data/lib/elastic_graph/schema_definition/factory.rb +19 -5
  5. data/lib/elastic_graph/schema_definition/indexing/derived_fields/append_only_set.rb +1 -1
  6. data/lib/elastic_graph/schema_definition/indexing/derived_fields/field_initializer_support.rb +1 -1
  7. data/lib/elastic_graph/schema_definition/indexing/derived_fields/immutable_value.rb +1 -1
  8. data/lib/elastic_graph/schema_definition/indexing/derived_fields/min_or_max_value.rb +1 -1
  9. data/lib/elastic_graph/schema_definition/indexing/derived_indexed_type.rb +1 -1
  10. data/lib/elastic_graph/schema_definition/indexing/event_envelope.rb +1 -1
  11. data/lib/elastic_graph/schema_definition/indexing/field.rb +1 -1
  12. data/lib/elastic_graph/schema_definition/indexing/field_reference.rb +1 -1
  13. data/lib/elastic_graph/schema_definition/indexing/field_type/enum.rb +1 -1
  14. data/lib/elastic_graph/schema_definition/indexing/field_type/object.rb +1 -1
  15. data/lib/elastic_graph/schema_definition/indexing/field_type/scalar.rb +1 -1
  16. data/lib/elastic_graph/schema_definition/indexing/field_type/union.rb +1 -1
  17. data/lib/elastic_graph/schema_definition/indexing/index.rb +1 -1
  18. data/lib/elastic_graph/schema_definition/indexing/json_schema_field_metadata.rb +1 -1
  19. data/lib/elastic_graph/schema_definition/indexing/json_schema_with_metadata.rb +1 -1
  20. data/lib/elastic_graph/schema_definition/indexing/list_counts_mapping.rb +1 -1
  21. data/lib/elastic_graph/schema_definition/indexing/relationship_resolver.rb +1 -1
  22. data/lib/elastic_graph/schema_definition/indexing/rollover_config.rb +1 -1
  23. data/lib/elastic_graph/schema_definition/indexing/update_target_factory.rb +1 -1
  24. data/lib/elastic_graph/schema_definition/indexing/update_target_resolver.rb +1 -1
  25. data/lib/elastic_graph/schema_definition/json_schema_pruner.rb +1 -1
  26. data/lib/elastic_graph/schema_definition/mixins/can_be_graphql_only.rb +1 -1
  27. data/lib/elastic_graph/schema_definition/mixins/has_derived_graphql_type_customizations.rb +1 -1
  28. data/lib/elastic_graph/schema_definition/mixins/has_directives.rb +1 -1
  29. data/lib/elastic_graph/schema_definition/mixins/has_documentation.rb +1 -1
  30. data/lib/elastic_graph/schema_definition/mixins/has_indices.rb +4 -17
  31. data/lib/elastic_graph/schema_definition/mixins/has_readable_to_s_and_inspect.rb +1 -1
  32. data/lib/elastic_graph/schema_definition/mixins/has_subtypes.rb +1 -1
  33. data/lib/elastic_graph/schema_definition/mixins/has_type_info.rb +2 -2
  34. data/lib/elastic_graph/schema_definition/mixins/implements_interfaces.rb +2 -13
  35. data/lib/elastic_graph/schema_definition/mixins/supports_default_value.rb +1 -1
  36. data/lib/elastic_graph/schema_definition/mixins/supports_filtering_and_aggregation.rb +23 -8
  37. data/lib/elastic_graph/schema_definition/mixins/verifies_graphql_name.rb +1 -1
  38. data/lib/elastic_graph/schema_definition/rake_tasks.rb +1 -1
  39. data/lib/elastic_graph/schema_definition/results.rb +5 -5
  40. data/lib/elastic_graph/schema_definition/schema_artifact_manager.rb +1 -1
  41. data/lib/elastic_graph/schema_definition/schema_elements/argument.rb +1 -1
  42. data/lib/elastic_graph/schema_definition/schema_elements/built_in_types.rb +108 -216
  43. data/lib/elastic_graph/schema_definition/schema_elements/deprecated_element.rb +1 -1
  44. data/lib/elastic_graph/schema_definition/schema_elements/directive.rb +1 -1
  45. data/lib/elastic_graph/schema_definition/schema_elements/enum_type.rb +1 -1
  46. data/lib/elastic_graph/schema_definition/schema_elements/enum_value.rb +1 -1
  47. data/lib/elastic_graph/schema_definition/schema_elements/enum_value_namer.rb +1 -1
  48. data/lib/elastic_graph/schema_definition/schema_elements/enums_for_indexed_types.rb +1 -1
  49. data/lib/elastic_graph/schema_definition/schema_elements/field.rb +103 -142
  50. data/lib/elastic_graph/schema_definition/schema_elements/field_path.rb +1 -1
  51. data/lib/elastic_graph/schema_definition/schema_elements/field_source.rb +1 -1
  52. data/lib/elastic_graph/schema_definition/schema_elements/graphql_sdl_enumerator.rb +1 -1
  53. data/lib/elastic_graph/schema_definition/schema_elements/input_field.rb +1 -1
  54. data/lib/elastic_graph/schema_definition/schema_elements/input_type.rb +1 -1
  55. data/lib/elastic_graph/schema_definition/schema_elements/interface_type.rb +1 -1
  56. data/lib/elastic_graph/schema_definition/schema_elements/list_counts_state.rb +1 -1
  57. data/lib/elastic_graph/schema_definition/schema_elements/object_type.rb +1 -1
  58. data/lib/elastic_graph/schema_definition/schema_elements/relationship.rb +1 -1
  59. data/lib/elastic_graph/schema_definition/schema_elements/scalar_type.rb +20 -2
  60. data/lib/elastic_graph/schema_definition/schema_elements/sort_order_enum_value.rb +1 -1
  61. data/lib/elastic_graph/schema_definition/schema_elements/sub_aggregation_path.rb +1 -1
  62. data/lib/elastic_graph/schema_definition/schema_elements/type_namer.rb +2 -1
  63. data/lib/elastic_graph/schema_definition/schema_elements/type_reference.rb +8 -10
  64. data/lib/elastic_graph/schema_definition/schema_elements/type_with_subfields.rb +7 -27
  65. data/lib/elastic_graph/schema_definition/schema_elements/union_type.rb +1 -1
  66. data/lib/elastic_graph/schema_definition/scripting/file_system_repository.rb +1 -1
  67. data/lib/elastic_graph/schema_definition/scripting/script.rb +1 -1
  68. data/lib/elastic_graph/schema_definition/scripting/scripts/update/index_data.painless +2 -22
  69. data/lib/elastic_graph/schema_definition/state.rb +1 -1
  70. data/lib/elastic_graph/schema_definition/test_support.rb +1 -1
  71. metadata +28 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 06ba81265998cca23b0d1cd192b02d2b90dbf5f5ee4719aab4af06928aabd797
4
- data.tar.gz: f99da1ae45737e89412090c976c1e00fdb64a2c035cd3c3fc90797ce090ec874
3
+ metadata.gz: 54e9fd94b73a36f09e090c68605743766da45b9f1777e5622a8b1b0e6985a5a5
4
+ data.tar.gz: c656f8bf79e9dcfa7bf88d9f4e2944a606d436b440e337fd3db9d064ad59aad5
5
5
  SHA512:
6
- metadata.gz: b1528be317ffe61b04c3a9e8dc5c2f42c55e721d6998365d600219acbaa7b412319220a9a2bd51303bdaf6c20b7cee83f6282bb9469a0faba5c5ecc1b4218a09
7
- data.tar.gz: ff47ac4507c7cf94e918be6ddf5c72a44d2d6d3712bc7a9101819df8e3b6d1c39bc0e598d5600ce4ab66a73067686940806dfb03ff27fbfb7719bc571f6f66a0
6
+ metadata.gz: d348ef2187ff3dbd29c7c3c198a61153fdf86219bca6b37c35f92bafa0bbc17a26ac46d655f5a871c5d33f14568d27ff91a413ed1431a714491119b94d2ac67b
7
+ data.tar.gz: 7db25426957cd9ddfd2a0af5ee78c7248040a270438d95016b73edf9e2c74a08f830866f17a381488bf11706624ef0c58cfe41405b2eaaa485b5277fd2f75914
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2024 - 2026 Block, Inc.
3
+ Copyright (c) 2024 - 2025 Block, Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -300,35 +300,28 @@ module ElasticGraph
300
300
  # @param defined_at [String] the `require` path of the resolver
301
301
  # @param resolver_config [Hash<Symbol, Object>] configuration options for the resolver, to support parameterized resolvers
302
302
  # @return [void]
303
- # @see Mixins::HasIndices#resolve_fields_with
304
- # @see SchemaElements::Field#resolve_with
305
303
  #
306
304
  # @example Register a custom resolver for use by a custom `Query` field
307
305
  # # In `add_resolver.rb`:
308
306
  # class AddResolver
309
307
  # def initialize(elasticgraph_graphql:, config:)
310
- # @multiplier = config.fetch(:multiplier, 1)
311
308
  # end
312
309
  #
313
310
  # def resolve(field:, object:, args:, context:)
314
- # sum = args.fetch("x") + args.fetch("y")
315
- # sum * @multiplier
311
+ # args.fetch("x") + args.fetch("y")
316
312
  # end
317
313
  # end
318
314
  #
319
315
  # # In `config/schema.rb`:
320
316
  # ElasticGraph.define_schema do |schema|
321
317
  # require(resolver_path = "add_resolver")
322
- # schema.register_graphql_resolver :add,
323
- # AddResolver,
324
- # defined_at: resolver_path,
325
- # multiplier: 2 # extra args are passed to the resolver within `config`.
318
+ # schema.register_graphql_resolver :add, AddResolver, defined_at: resolver_path
326
319
  #
327
320
  # schema.on_root_query_type do |t|
328
321
  # t.field "add", "Int" do |f|
329
322
  # f.argument "x", "Int!"
330
323
  # f.argument "y", "Int!"
331
- # f.resolve_with :add
324
+ # f.resolver = :add
332
325
  # end
333
326
  # end
334
327
  # end
@@ -361,7 +354,7 @@ module ElasticGraph
361
354
  #
362
355
  # schema.on_root_query_type do |t|
363
356
  # t.field "artist", "Artist" do |f|
364
- # f.resolve_with :artist
357
+ # f.resolver = :artist
365
358
  # end
366
359
  # end
367
360
  # end
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -286,7 +286,7 @@ module ElasticGraph
286
286
  new_object_type @state.type_ref(index_leaf_type).as_aggregated_values.name do |type|
287
287
  type.graphql_only true
288
288
  type.documentation "A return type used from aggregations to provided aggregated values over `#{index_leaf_type}` fields."
289
- type.resolve_fields_with :object_with_lookahead
289
+ type.default_graphql_resolver = :object_with_lookahead
290
290
  type.override_runtime_metadata(elasticgraph_category: :scalar_aggregated_values)
291
291
 
292
292
  type.field @state.schema_elements.approximate_distinct_value_count, "JsonSafeLong", graphql_only: true do |f|
@@ -433,14 +433,16 @@ 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
- t.resolve_fields_with :object_without_lookahead
440
+ t.default_graphql_resolver = :object_without_lookahead
439
441
  t.override_runtime_metadata(elasticgraph_category: :relay_edge)
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 a pagination `Cursor`.
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
 
@@ -463,7 +477,7 @@ module ElasticGraph
463
477
  type_ref = @state.type_ref(type_name)
464
478
  new_object_type type_ref.as_connection.name do |t|
465
479
  t.relay_pagination_type = true
466
- t.resolve_fields_with :object_without_lookahead
480
+ t.default_graphql_resolver = :object_without_lookahead
467
481
  t.override_runtime_metadata(elasticgraph_category: :relay_connection)
468
482
 
469
483
  if support_pagination
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -20,14 +20,14 @@ module ElasticGraph
20
20
  attr_reader :runtime_metadata_overrides
21
21
 
22
22
  # @return [::Symbol, nil] the default GraphQL resolver to use for fields on this type
23
- attr_reader :default_graphql_resolver
24
- # @dynamic default_graphql_resolver
23
+ attr_accessor :default_graphql_resolver
24
+ # @dynamic default_graphql_resolver, default_graphql_resolver=
25
25
 
26
26
  # @private
27
27
  def initialize(*args, **options)
28
28
  super(*args, **options)
29
29
  @runtime_metadata_overrides = {}
30
- resolve_fields_with :get_record_field_value
30
+ self.default_graphql_resolver = :get_record_field_value
31
31
  yield self
32
32
 
33
33
  # Freeze `indices` so that the indexable status of a type does not change after instantiation.
@@ -72,19 +72,6 @@ module ElasticGraph
72
72
  indices.replace([Indexing::Index.new(name, settings, schema_def_state, self, &block)])
73
73
  end
74
74
 
75
- # Configures the default GraphQL resolver that will be used to resolve the fields of this type. Individual fields
76
- # can override this using {SchemaElements::Field#resolve_with}.
77
- #
78
- # @param default_resolver_name [Symbol] name of the GraphQL resolver to use as the default for fields of this type
79
- # @param config [Hash<Symbol, Object>] configuration parameters for the resolver
80
- # @return [void]
81
- # @see API#register_graphql_resolver
82
- def resolve_fields_with(default_resolver_name, **config)
83
- @default_graphql_resolver = default_resolver_name&.then do |name|
84
- SchemaArtifacts::RuntimeMetadata::ConfiguredGraphQLResolver.new(name, config)
85
- end
86
- end
87
-
88
75
  # List of indices. (Currently we only store one but we may support multiple in the future).
89
76
  #
90
77
  # @private
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -42,7 +42,7 @@ module ElasticGraph
42
42
  :norms,
43
43
  :null_value,
44
44
  :search_analyzer,
45
- :type,
45
+ :type
46
46
  ]
47
47
 
48
48
  # Defines the Elasticsearch/OpenSearch [field mapping type](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/mapping-types.html)
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -112,22 +112,11 @@ module ElasticGraph
112
112
  if implemented_interfaces.empty?
113
113
  name
114
114
  else
115
- # Include all ancestor interfaces in SDL
116
- all_interfaces = recursively_resolve_interface_supertypes.uniq
117
- "#{name} implements #{all_interfaces.map(&:name).sort.join(" & ")}"
115
+ "#{name} implements #{implemented_interfaces.join(" & ")}"
118
116
  end
119
117
 
120
118
  generate_sdl(name_section: name_section, &field_arg_selector)
121
119
  end
122
-
123
- private
124
-
125
- def recursively_resolve_interface_supertypes
126
- implemented_interfaces.flat_map do |interface_ref|
127
- interface = interface_ref.resolved # : SchemaElements::InterfaceType
128
- [interface] + interface.send(:recursively_resolve_interface_supertypes)
129
- end
130
- end
131
120
  end
132
121
  end
133
122
  end
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -46,7 +46,7 @@ module ElasticGraph
46
46
  # Record metadata that is necessary for elasticgraph-graphql to correctly recognize and handle
47
47
  # this sub-aggregation correctly.
48
48
  t.override_runtime_metadata(elasticgraph_category: :nested_sub_aggregation_connection)
49
- t.resolve_fields_with :object_without_lookahead
49
+ t.default_graphql_resolver = :object_without_lookahead
50
50
  end
51
51
  end
52
52
 
@@ -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
 
@@ -117,7 +118,7 @@ module ElasticGraph
117
118
  schema_def_state.sub_aggregation_paths_for(nested_field_ref.parent_type).map do |path|
118
119
  schema_def_state.factory.new_object_type type_ref.as_sub_aggregation(parent_doc_types: path.parent_doc_types).name do |t|
119
120
  t.documentation "Return type representing a bucket of `#{name}` objects for a sub-aggregation within each `#{type_ref.as_parent_aggregation(parent_doc_types: path.parent_doc_types).name}`."
120
- t.resolve_fields_with :object_without_lookahead
121
+ t.default_graphql_resolver = :object_without_lookahead
121
122
 
122
123
  t.field schema_def_state.schema_elements.count_detail, "AggregationCountDetail", graphql_only: true do |f|
123
124
  f.documentation "Details of the count of `#{name}` documents in a sub-aggregation bucket."
@@ -165,7 +166,7 @@ module ElasticGraph
165
166
  schema_def_state.factory.new_object_type agg_sub_aggs_type_ref.name do |t|
166
167
  under_field_description = "under `#{path.field_path_string}` " unless path.field_path.empty?
167
168
  t.documentation "Provides access to the `#{schema_def_state.schema_elements.sub_aggregations}` #{under_field_description}within each `#{type_ref.as_parent_aggregation(parent_doc_types: path.parent_doc_types).name}`."
168
- t.resolve_fields_with :object_with_lookahead
169
+ t.default_graphql_resolver = :object_with_lookahead
169
170
 
170
171
  sub_aggregatable_fields.each do |field|
171
172
  if field.nested?
@@ -228,7 +229,7 @@ module ElasticGraph
228
229
 
229
230
  # Record metadata that is necessary for elasticgraph-graphql to correctly recognize and handle
230
231
  # this indexed aggregation type correctly.
231
- t.resolve_fields_with :object_without_lookahead
232
+ t.default_graphql_resolver = :object_without_lookahead
232
233
  t.override_runtime_metadata(source_type: name, elasticgraph_category: :indexed_aggregation)
233
234
  end
234
235
  end
@@ -240,7 +241,7 @@ module ElasticGraph
240
241
 
241
242
  new_non_empty_object_type type_ref.as_grouped_by.name do |t|
242
243
  t.documentation "Type used to specify the `#{name}` fields to group by for aggregations."
243
- t.resolve_fields_with :object_with_lookahead
244
+ t.default_graphql_resolver = :object_with_lookahead
244
245
 
245
246
  graphql_fields_by_name.values.each do |field|
246
247
  field.define_grouped_by_field(t)
@@ -255,7 +256,7 @@ module ElasticGraph
255
256
 
256
257
  new_non_empty_object_type type_ref.as_aggregated_values.name do |t|
257
258
  t.documentation "Type used to perform aggregation computations on `#{name}` fields."
258
- t.resolve_fields_with :object_with_lookahead
259
+ t.default_graphql_resolver = :object_with_lookahead
259
260
 
260
261
  graphql_fields_by_name.values.each do |field|
261
262
  field.define_aggregated_values_field(t)
@@ -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.default_graphql_resolver = :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?
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -116,7 +116,7 @@ module ElasticGraph
116
116
  def define_root_graphql_type
117
117
  state.api.object_type "Query" do |query_type|
118
118
  query_type.documentation "The query entry point for the entire schema."
119
- query_type.resolve_fields_with nil
119
+ query_type.default_graphql_resolver = nil
120
120
 
121
121
  state.types_by_name.values.select(&:indexed?).sort_by(&:name).each do |type|
122
122
  # @type var indexed_type: Mixins::HasIndices & _Type
@@ -130,7 +130,7 @@ module ElasticGraph
130
130
  singular: indexed_type.singular_root_query_field_name
131
131
  ) do |f|
132
132
  f.documentation "Fetches `#{indexed_type.name}`s based on the provided arguments."
133
- f.resolve_with :list_records
133
+ f.resolver = :list_records
134
134
  f.hide_relationship_runtime_metadata = true
135
135
  indexed_type.root_query_fields_customizations&.call(f)
136
136
  end
@@ -364,8 +364,8 @@ module ElasticGraph
364
364
  .object_types_by_name
365
365
  .each do |type_name, type|
366
366
  type.graphql_fields_by_name.each do |field_name, field|
367
- if (resolver_name = field.resolver&.name)
368
- fields_by_resolvers[resolver_name] << "#{type_name}.#{field_name}"
367
+ if (resolver = field.resolver)
368
+ fields_by_resolvers[resolver] << "#{type_name}.#{field_name}"
369
369
  end
370
370
  end
371
371
  end
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at
@@ -1,4 +1,4 @@
1
- # Copyright 2024 - 2026 Block, Inc.
1
+ # Copyright 2024 - 2025 Block, Inc.
2
2
  #
3
3
  # Use of this source code is governed by an MIT-style
4
4
  # license that can be found in the LICENSE file or at