Skip to content

Commit b00f34b

Browse files
committed
chore: code cleanup
1 parent 7af225c commit b00f34b

File tree

2 files changed

+75
-75
lines changed

2 files changed

+75
-75
lines changed

include/graphqlservice/internal/Schema.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class [[nodiscard("unnecessary construction")]] Schema : public std::enable_shar
4545
GRAPHQLSERVICE_EXPORT explicit Schema(
4646
bool noIntrospection = false, std::string_view description = "");
4747

48-
GRAPHQLSERVICE_EXPORT std::shared_ptr<Schema> StitchSchema(
48+
[[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::shared_ptr<Schema> StitchSchema(
4949
const std::shared_ptr<const Schema>& added) const;
5050

5151
GRAPHQLSERVICE_EXPORT void AddQueryType(std::shared_ptr<ObjectType> query);

src/Schema.cpp

Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -319,30 +319,30 @@ std::shared_ptr<Schema> Schema::StitchSchema(const std::shared_ptr<const Schema>
319319
const auto itrOriginal = _typeMap.find(name);
320320
const auto itrAdded = added->_typeMap.find(name);
321321
internal::string_view_set names;
322-
std::vector<std::shared_ptr<const Field>> stitchedValues;
322+
std::vector<std::shared_ptr<const Field>> stitchedFields;
323323

324324
if (itrOriginal != _typeMap.end())
325325
{
326326
const auto& originalType = _types[itrOriginal->second].second;
327327
const auto& interfaceFields = originalType->fields();
328328

329-
for (const auto& field : interfaceFields)
329+
for (const auto& interfaceField : interfaceFields)
330330
{
331331
std::vector<std::shared_ptr<const InputValue>> stitchedArgs;
332332

333-
for (const auto& value : field->args())
333+
for (const auto& arg : interfaceField->args())
334334
{
335-
stitchedArgs.push_back(InputValue::Make(value->name(),
336-
value->description(),
337-
schema->StitchFieldType(value->type().lock()),
338-
value->defaultValue()));
335+
stitchedArgs.push_back(InputValue::Make(arg->name(),
336+
arg->description(),
337+
schema->StitchFieldType(arg->type().lock()),
338+
arg->defaultValue()));
339339
}
340340

341-
names.emplace(field->name());
342-
stitchedValues.push_back(Field::Make(field->name(),
343-
field->description(),
344-
field->deprecationReason(),
345-
schema->StitchFieldType(field->type().lock()),
341+
names.emplace(interfaceField->name());
342+
stitchedFields.push_back(Field::Make(interfaceField->name(),
343+
interfaceField->description(),
344+
interfaceField->deprecationReason(),
345+
schema->StitchFieldType(interfaceField->type().lock()),
346346
std::move(stitchedArgs)));
347347
}
348348
}
@@ -352,32 +352,32 @@ std::shared_ptr<Schema> Schema::StitchSchema(const std::shared_ptr<const Schema>
352352
const auto& addedType = _types[itrAdded->second].second;
353353
const auto& interfaceFields = addedType->fields();
354354

355-
for (const auto& field : interfaceFields)
355+
for (const auto& interfaceField : interfaceFields)
356356
{
357-
if (!names.emplace(field->name()).second)
357+
if (!names.emplace(interfaceField->name()).second)
358358
{
359359
continue;
360360
}
361361

362362
std::vector<std::shared_ptr<const InputValue>> stitchedArgs;
363363

364-
for (const auto& value : field->args())
364+
for (const auto& arg : interfaceField->args())
365365
{
366-
stitchedArgs.push_back(InputValue::Make(value->name(),
367-
value->description(),
368-
schema->StitchFieldType(value->type().lock()),
369-
value->defaultValue()));
366+
stitchedArgs.push_back(InputValue::Make(arg->name(),
367+
arg->description(),
368+
schema->StitchFieldType(arg->type().lock()),
369+
arg->defaultValue()));
370370
}
371371

372-
stitchedValues.push_back(Field::Make(field->name(),
373-
field->description(),
374-
field->deprecationReason(),
375-
schema->StitchFieldType(field->type().lock()),
372+
stitchedFields.push_back(Field::Make(interfaceField->name(),
373+
interfaceField->description(),
374+
interfaceField->deprecationReason(),
375+
schema->StitchFieldType(interfaceField->type().lock()),
376376
std::move(stitchedArgs)));
377377
}
378378
}
379379

380-
stitchedType->AddFields(std::move(stitchedValues));
380+
stitchedType->AddFields(std::move(stitchedFields));
381381
}
382382

383383
for (const auto& entry : unionTypes)
@@ -391,32 +391,32 @@ std::shared_ptr<Schema> Schema::StitchSchema(const std::shared_ptr<const Schema>
391391
if (itrOriginal != _typeMap.end())
392392
{
393393
const auto& originalType = _types[itrOriginal->second].second;
394-
const auto& unionValues = originalType->possibleTypes();
394+
const auto& possibleTypes = originalType->possibleTypes();
395395

396-
for (const auto& value : unionValues)
396+
for (const auto& possibleType : possibleTypes)
397397
{
398-
const auto possibleType = value.lock();
398+
const auto possible = possibleType.lock();
399399

400-
names.emplace(possibleType->name());
401-
stitchedValues.push_back(schema->LookupType(possibleType->name()));
400+
names.emplace(possible->name());
401+
stitchedValues.push_back(schema->LookupType(possible->name()));
402402
}
403403
}
404404

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

410-
for (const auto& value : unionValues)
410+
for (const auto& possibleType : possibleTypes)
411411
{
412-
const auto possibleType = value.lock();
412+
const auto possible = possibleType.lock();
413413

414-
if (!names.emplace(possibleType->name()).second)
414+
if (!names.emplace(possible->name()).second)
415415
{
416416
continue;
417417
}
418418

419-
stitchedValues.push_back(schema->LookupType(possibleType->name()));
419+
stitchedValues.push_back(schema->LookupType(possible->name()));
420420
}
421421
}
422422

@@ -436,75 +436,75 @@ std::shared_ptr<Schema> Schema::StitchSchema(const std::shared_ptr<const Schema>
436436
if (itrOriginal != _typeMap.end())
437437
{
438438
const auto& originalType = _types[itrOriginal->second].second;
439-
const auto& interfaceValues = originalType->interfaces();
439+
const auto& objectInterfaces = originalType->interfaces();
440440

441-
for (const auto& value : interfaceValues)
441+
for (const auto& interfaceType : objectInterfaces)
442442
{
443-
interfaceNames.emplace(value->name());
444-
stitchedInterfaces.push_back(interfaceTypes[value->name()]);
443+
interfaceNames.emplace(interfaceType->name());
444+
stitchedInterfaces.push_back(interfaceTypes[interfaceType->name()]);
445445
}
446446

447447
const auto& objectFields = originalType->fields();
448448

449-
for (const auto& field : objectFields)
449+
for (const auto& objectField : objectFields)
450450
{
451451
std::vector<std::shared_ptr<const InputValue>> stitchedArgs;
452452

453-
for (const auto& value : field->args())
453+
for (const auto& arg : objectField->args())
454454
{
455-
stitchedArgs.push_back(InputValue::Make(value->name(),
456-
value->description(),
457-
schema->StitchFieldType(value->type().lock()),
458-
value->defaultValue()));
455+
stitchedArgs.push_back(InputValue::Make(arg->name(),
456+
arg->description(),
457+
schema->StitchFieldType(arg->type().lock()),
458+
arg->defaultValue()));
459459
}
460460

461-
fieldNames.emplace(field->name());
462-
stitchedValues.push_back(Field::Make(field->name(),
463-
field->description(),
464-
field->deprecationReason(),
465-
schema->StitchFieldType(field->type().lock()),
461+
fieldNames.emplace(objectField->name());
462+
stitchedValues.push_back(Field::Make(objectField->name(),
463+
objectField->description(),
464+
objectField->deprecationReason(),
465+
schema->StitchFieldType(objectField->type().lock()),
466466
std::move(stitchedArgs)));
467467
}
468468
}
469469

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

475-
for (const auto& value : interfaceValues)
475+
for (const auto& interfaceType : objectInterfaces)
476476
{
477-
if (!interfaceNames.emplace(value->name()).second)
477+
if (!interfaceNames.emplace(interfaceType->name()).second)
478478
{
479479
continue;
480480
}
481481

482-
stitchedInterfaces.push_back(interfaceTypes[value->name()]);
482+
stitchedInterfaces.push_back(interfaceTypes[interfaceType->name()]);
483483
}
484484

485485
const auto& objectFields = addedType->fields();
486486

487-
for (const auto& field : objectFields)
487+
for (const auto& objectField : objectFields)
488488
{
489-
if (!fieldNames.emplace(field->name()).second)
489+
if (!fieldNames.emplace(objectField->name()).second)
490490
{
491491
continue;
492492
}
493493

494494
std::vector<std::shared_ptr<const InputValue>> stitchedArgs;
495495

496-
for (const auto& value : field->args())
496+
for (const auto& arg : objectField->args())
497497
{
498-
stitchedArgs.push_back(InputValue::Make(value->name(),
499-
value->description(),
500-
schema->StitchFieldType(value->type().lock()),
501-
value->defaultValue()));
498+
stitchedArgs.push_back(InputValue::Make(arg->name(),
499+
arg->description(),
500+
schema->StitchFieldType(arg->type().lock()),
501+
arg->defaultValue()));
502502
}
503503

504-
stitchedValues.push_back(Field::Make(field->name(),
505-
field->description(),
506-
field->deprecationReason(),
507-
schema->StitchFieldType(field->type().lock()),
504+
stitchedValues.push_back(Field::Make(objectField->name(),
505+
objectField->description(),
506+
objectField->deprecationReason(),
507+
schema->StitchFieldType(objectField->type().lock()),
508508
std::move(stitchedArgs)));
509509
}
510510
}
@@ -525,12 +525,12 @@ std::shared_ptr<Schema> Schema::StitchSchema(const std::shared_ptr<const Schema>
525525

526526
std::vector<std::shared_ptr<const InputValue>> stitchedArgs;
527527

528-
for (const auto& value : originalDirective->args())
528+
for (const auto& arg : originalDirective->args())
529529
{
530-
stitchedArgs.push_back(InputValue::Make(value->name(),
531-
value->description(),
532-
schema->StitchFieldType(value->type().lock()),
533-
value->defaultValue()));
530+
stitchedArgs.push_back(InputValue::Make(arg->name(),
531+
arg->description(),
532+
schema->StitchFieldType(arg->type().lock()),
533+
arg->defaultValue()));
534534
}
535535

536536
stitchedDirectives.push_back(Directive::Make(originalDirective->name(),
@@ -549,12 +549,12 @@ std::shared_ptr<Schema> Schema::StitchSchema(const std::shared_ptr<const Schema>
549549

550550
std::vector<std::shared_ptr<const InputValue>> stitchedArgs;
551551

552-
for (const auto& value : addedDirective->args())
552+
for (const auto& arg : addedDirective->args())
553553
{
554-
stitchedArgs.push_back(InputValue::Make(value->name(),
555-
value->description(),
556-
schema->StitchFieldType(value->type().lock()),
557-
value->defaultValue()));
554+
stitchedArgs.push_back(InputValue::Make(arg->name(),
555+
arg->description(),
556+
schema->StitchFieldType(arg->type().lock()),
557+
arg->defaultValue()));
558558
}
559559

560560
stitchedDirectives.push_back(Directive::Make(addedDirective->name(),

0 commit comments

Comments
 (0)