Skip to content

Commit 62887b0

Browse files
committed
fix: misc bugs in Schema merge
1 parent fbbd02a commit 62887b0

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/Schema.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ std::shared_ptr<Schema> Schema::StitchSchema(const std::shared_ptr<const Schema>
155155

156156
if (itrOriginal != _typeMap.end())
157157
{
158-
break;
158+
continue;
159159
}
160160

161161
switch (addedType->kind())
@@ -247,7 +247,7 @@ std::shared_ptr<Schema> Schema::StitchSchema(const std::shared_ptr<const Schema>
247247

248248
if (itrAdded != added->_typeMap.end())
249249
{
250-
const auto& addedType = _types[itrAdded->second].second;
250+
const auto& addedType = added->_types[itrAdded->second].second;
251251
const auto& enumValues = addedType->enumValues();
252252

253253
for (const auto& value : enumValues)
@@ -293,7 +293,7 @@ std::shared_ptr<Schema> Schema::StitchSchema(const std::shared_ptr<const Schema>
293293

294294
if (itrAdded != added->_typeMap.end())
295295
{
296-
const auto& addedType = _types[itrAdded->second].second;
296+
const auto& addedType = added->_types[itrAdded->second].second;
297297
const auto& inputObjectValues = addedType->inputFields();
298298

299299
for (const auto& value : inputObjectValues)
@@ -349,7 +349,7 @@ std::shared_ptr<Schema> Schema::StitchSchema(const std::shared_ptr<const Schema>
349349

350350
if (itrAdded != added->_typeMap.end())
351351
{
352-
const auto& addedType = _types[itrAdded->second].second;
352+
const auto& addedType = added->_types[itrAdded->second].second;
353353
const auto& interfaceFields = addedType->fields();
354354

355355
for (const auto& interfaceField : interfaceFields)
@@ -404,7 +404,7 @@ std::shared_ptr<Schema> Schema::StitchSchema(const std::shared_ptr<const Schema>
404404

405405
if (itrAdded != added->_typeMap.end())
406406
{
407-
const auto& addedType = _types[itrAdded->second].second;
407+
const auto& addedType = added->_types[itrAdded->second].second;
408408
const auto& possibleTypes = addedType->possibleTypes();
409409

410410
for (const auto& possibleType : possibleTypes)
@@ -469,7 +469,7 @@ std::shared_ptr<Schema> Schema::StitchSchema(const std::shared_ptr<const Schema>
469469

470470
if (itrAdded != added->_typeMap.end())
471471
{
472-
const auto& addedType = _types[itrAdded->second].second;
472+
const auto& addedType = added->_types[itrAdded->second].second;
473473
const auto& objectInterfaces = addedType->interfaces();
474474

475475
for (const auto& interfaceType : objectInterfaces)
@@ -605,11 +605,12 @@ std::shared_ptr<const BaseType> Schema::StitchFieldType(std::shared_ptr<const Ba
605605
switch (fieldType->kind())
606606
{
607607
case introspection::TypeKind::LIST:
608-
return WrapType(introspection::TypeKind::LIST, StitchFieldType(std::move(fieldType)));
608+
return WrapType(introspection::TypeKind::LIST,
609+
StitchFieldType(fieldType->ofType().lock()));
609610

610611
case introspection::TypeKind::NON_NULL:
611612
return WrapType(introspection::TypeKind::NON_NULL,
612-
StitchFieldType(std::move(fieldType)));
613+
StitchFieldType(fieldType->ofType().lock()));
613614

614615
default:
615616
return LookupType(fieldType->name());

0 commit comments

Comments
 (0)