Skip to content

Commit 72001a1

Browse files
jwilsclaude
andcommitted
Fix RBS syntax error: use concrete ObjectType instead of type alias
The `anyObjectType` is a type alias which cannot be used in RBS module extension syntax. Use `ObjectType` as the concrete type instead. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 13b45e2 commit 72001a1

4 files changed

Lines changed: 22 additions & 9 deletions

File tree

elasticgraph-protobuf/lib/elastic_graph/protobuf/schema_definition/schema.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,7 @@ def to_proto
122122
private
123123

124124
def indexed_types
125-
types =
126-
if @results.respond_to?(:schema_artifact_types)
127-
@results.schema_artifact_types
128-
else
129-
# Unit tests sometimes provide light-weight results doubles instead of a full `SchemaDefinition::Results`.
130-
@results.__send__(:all_types)
131-
end
125+
types = @results.schema_artifact_types
132126

133127
types
134128
.filter_map { |type| (_ = type).index_def if type.respond_to?(:index_def) }

elasticgraph-protobuf/sig/elastic_graph/protobuf/schema_definition/object_interface_and_union_extension.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module ElasticGraph
22
module Protobuf
33
module SchemaDefinition
4-
module ObjectInterfaceAndUnionExtension : ::ElasticGraph::SchemaDefinition::SchemaElements::anyObjectType
4+
module ObjectInterfaceAndUnionExtension : ::ElasticGraph::SchemaDefinition::SchemaElements::ObjectType
55
def to_proto_field_type: () -> ::String
66
end
77
end

elasticgraph-protobuf/spec/unit/elastic_graph/protobuf/schema_definition/schema_edge_cases_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ def build_fake_results_with_root_types(*indexed_types)
613613
end
614614

615615
fake_results = ::Object.new
616-
fake_results.define_singleton_method(:all_types) { wrappers }
616+
fake_results.define_singleton_method(:schema_artifact_types) { wrappers }
617617
fake_results
618618
end
619619

elasticgraph-schema_definition/spec/unit/elastic_graph/schema_definition/graphql_schema/define_schema_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,25 @@ module SchemaDefinition
5858
expect(api.results).to respond_to(:available_json_schema_versions)
5959
end
6060

61+
it "exposes schema_artifact_types that includes user-defined and built-in types" do
62+
api = API.new(schema_elements, true)
63+
64+
api.as_active_instance do
65+
ElasticGraph.define_schema do |schema|
66+
schema.json_schema_version 1
67+
schema.object_type("Widget") do |t|
68+
t.field "id", "ID"
69+
end
70+
end
71+
end
72+
73+
types = api.results.schema_artifact_types
74+
type_names = types.map(&:name)
75+
76+
expect(type_names).to include("Widget")
77+
expect(type_names).to include("Int")
78+
end
79+
6180
it "allows the factory to build an object type even when no block is provided" do
6281
api = API.new(schema_elements, true)
6382

0 commit comments

Comments
 (0)