@@ -1265,16 +1265,19 @@ std::shared_ptr<Object> Object::StitchObject(const std::shared_ptr<const Object>
1265
1265
1266
1266
if (schema && schema->supportsIntrospection ())
1267
1267
{
1268
- resolvers.erase (" __schema" sv);
1269
- resolvers.emplace (" __schema" sv, [schema](ResolverParams&& params) {
1268
+ constexpr auto schemaField = R"gql( __schema)gql" sv;
1269
+ constexpr auto typeField = R"gql( __type)gql" sv;
1270
+
1271
+ resolvers.erase (schemaField);
1272
+ resolvers.emplace (schemaField, [schema](ResolverParams&& params) {
1270
1273
return Result<Object>::convert (
1271
1274
std::static_pointer_cast<Object>(std::make_shared<introspection::object::Schema>(
1272
1275
std::make_shared<introspection::Schema>(schema))),
1273
1276
std::move (params));
1274
1277
});
1275
1278
1276
- resolvers.erase (" __type " sv );
1277
- resolvers.emplace (" __type " sv , [schema](ResolverParams&& params) {
1279
+ resolvers.erase (typeField );
1280
+ resolvers.emplace (typeField , [schema](ResolverParams&& params) {
1278
1281
auto argName = ModifiedArgument<std::string>::require (" name" , params.arguments );
1279
1282
const auto & baseType = schema->LookupType (argName);
1280
1283
std::shared_ptr<introspection::object::Type> result { baseType
@@ -1813,7 +1816,7 @@ std::shared_ptr<const Request> Request::stitch(const std::shared_ptr<const Reque
1813
1816
{
1814
1817
TypeMap operations;
1815
1818
auto schema = _schema->StitchSchema (added->_schema );
1816
- std::shared_ptr<Object> query;
1819
+ std::shared_ptr<const Object> query;
1817
1820
auto itrOriginalQuery = _operations.find (strQuery);
1818
1821
auto itrAddedQuery = added->_operations .find (strQuery);
1819
1822
@@ -1835,47 +1838,58 @@ std::shared_ptr<const Request> Request::stitch(const std::shared_ptr<const Reque
1835
1838
1836
1839
if (query)
1837
1840
{
1838
- operations.emplace (strQuery, query);
1841
+ operations.emplace (strQuery, std::move ( query) );
1839
1842
}
1840
1843
1844
+ std::shared_ptr<const Object> mutation;
1841
1845
auto itrOriginalMutation = _operations.find (strMutation);
1842
1846
auto itrAddedMutation = added->_operations .find (strMutation);
1843
1847
1844
1848
if (itrOriginalMutation != _operations.end () && itrOriginalMutation->second )
1845
1849
{
1846
1850
if (itrAddedMutation != added->_operations .end () && itrAddedMutation->second )
1847
1851
{
1848
- operations.emplace (strMutation,
1849
- itrOriginalMutation->second ->StitchObject (itrAddedMutation->second ));
1852
+ mutation = itrOriginalMutation->second ->StitchObject (itrAddedMutation->second );
1850
1853
}
1851
1854
else
1852
1855
{
1853
- operations. emplace (strMutation, itrOriginalMutation->second ) ;
1856
+ mutation = itrOriginalMutation->second ;
1854
1857
}
1855
1858
}
1856
1859
else if (itrAddedMutation != added->_operations .end () && itrAddedMutation->second )
1857
1860
{
1858
- operations.emplace (strMutation, itrAddedMutation->second );
1861
+ mutation = itrAddedMutation->second ;
1862
+ }
1863
+
1864
+ if (mutation)
1865
+ {
1866
+ operations.emplace (strMutation, std::move (mutation));
1859
1867
}
1860
1868
1869
+ std::shared_ptr<const Object> subscription;
1861
1870
auto itrOriginalSubscription = _operations.find (strSubscription);
1862
1871
auto itrAddedSubscription = added->_operations .find (strSubscription);
1863
1872
1864
1873
if (itrOriginalSubscription != _operations.end () && itrOriginalSubscription->second )
1865
1874
{
1866
1875
if (itrAddedSubscription != added->_operations .end () && itrAddedSubscription->second )
1867
1876
{
1868
- operations. emplace (strSubscription,
1869
- itrOriginalSubscription->second ->StitchObject (itrAddedSubscription->second )) ;
1877
+ subscription =
1878
+ itrOriginalSubscription->second ->StitchObject (itrAddedSubscription->second );
1870
1879
}
1871
1880
else
1872
1881
{
1873
- operations. emplace (strSubscription, itrOriginalSubscription->second ) ;
1882
+ subscription = itrOriginalSubscription->second ;
1874
1883
}
1875
1884
}
1876
1885
else if (itrAddedSubscription != added->_operations .end () && itrAddedSubscription->second )
1877
1886
{
1878
- operations.emplace (strSubscription, itrAddedSubscription->second );
1887
+ subscription = itrAddedSubscription->second ;
1888
+ }
1889
+
1890
+ if (subscription)
1891
+ {
1892
+ operations.emplace (strSubscription, std::move (subscription));
1879
1893
}
1880
1894
1881
1895
class StitchedRequest : public Request
0 commit comments