Я использую Gatsby и GraphQL, и я новичок в GraphQL.
У меня есть следующее определение схемы:
exports.createSchemaCustomization = ({ actions }) => {
const { createTypes } = actions;
const typeDefs = `
type MarkdownRemark implements Node {
frontmatter: Frontmatter
}
type Frontmatter {
title: String!
products: [Product]
}
type Product @dontInfer {
name: String!
price(price: Int = 1): Float
description: String
images: [ProductImage]
}
type ProductImage {
url: String
}
`;
createTypes(typeDefs);
};
Затем на своей странице я использую следующий запрос:
query {
markdownRemark(fileRelativePath: { eq: "/content/pages/products.md" }) {
...TinaRemark
frontmatter {
title
products {
name
price
description
images {
url {
childImageSharp {
fluid(maxWidth: 1920) {
...GatsbyImageSharpFluid_withWebp
}
}
}
}
}
}
html
}
}
Затем я получаю следующую ошибку:
Field "url" must not have a selection since type "String" has no subfields.
У кого-нибудь есть какие-либо предложения о том, как обойти эту ошибку?
Кроме того, что такое childImageSharp
? Мне интересно, что терминология это определить. Является ли это GraphQL «селектором» или «функцией»?