在 GraphQL 中报错:Variable “$sessionId” of type “String” used in position expecting type “String!”.
1、在 GraphQL 中报错:Variable “$sessionId” of type “String” used in position expecting type “String!”.。如图12、查看请求查询3、查看 GraphQL 文档,$sessionId: String!。缺少了 !。如图24、在请求查询中调整后,不再报错。如图3
{
"errors": [
{
"message": "Variable \"$sessionId\" of type \"String\" used in position expecting type \"String!\".",
"extensions": {
"category": "graphql"
},
"locations": [
{
"line": 2,
"column": 163
},
{
"line": 8,
"column": 16
}
]
}
]
}
mutation ThemeUpdate($themeId: ID!, $settings: [ThemeSettingDataInput!], $sections: [ThemeSettingsDataSectionInput!], $appEmbeds: [ThemeSettingsDataBlockInput!], $sessionId: String) {
onlineStoreThemeSettingsDataUpdate(
themeId: $themeId
settings: $settings
sections: $sections
appEmbeds: $appEmbeds
sessionId: $sessionId
) {
sessionId
__typename
}
}
mutation ThemeUpdate($themeId: ID!, $settings: [ThemeSettingDataInput!], $sections: [ThemeSettingsDataSectionInput!], $appEmbeds: [ThemeSettingsDataBlockInput!], $sessionId: String!) {
onlineStoreThemeSettingsDataUpdate(
themeId: $themeId
settings: $settings
sections: $sections
appEmbeds: $appEmbeds
sessionId: $sessionId
) {
sessionId
__typename
}
}

