I have the following custom types (simplified for this post):
Blog Category (blog_category):
{
"Main" : {
"uid" : {
"type" : "UID",
"config" : {
"label" : "Page Slug",
"placeholder" : "Unique identifier for category URL"
}
},
"title" : {
"type" : "Text",
"config" : {
"label" : "title"
}
},
},
}
Blog Subcategory (blog_subcategory):
{
"Main" : {
"uid" : {
"type" : "UID",
"config" : {
"label" : "Page Slug",
"placeholder" : "Unique identifier for subcategory URL"
}
},
"title" : {
"type" : "Text",
"config" : {
"label" : "title"
}
},
"category" : {
"type" : "Link",
"config" : {
"select" : "document",
"customtypes" : [ "blog_category" ],
"label" : "Category"
}
}
}
}
I am fetching all blog_subcategory documents which have a category value using the following query:
const data = client.query(
[
Prismic.Predicates.at('document.type', 'blog_subcategory'),
Prismic.Predicates.has('my.blog_subcategory.category'),
],
opts
)
which results in this query string:
q=%5B%5Bat(document.type%2C+%22blog_subcategory%22)%5D%5Bhas(my.blog_subcategory.category)%5D%5D
If I have no blog_subcategory documents or no blog_subcategory documents with a category value set, I would expect the response from the request above to return 0 documents. Instead it returns a 400 response with the following error:
{
"message": "[function has(..)] unexpected field 'my.blog_subcategory.category' on line:1 col:46 in query '[[at(document.type, \"blog_subcategory\")][has(my.blog_subcategory.category)]]'\n[[at(document.type, \"blog_subcategory\")][has(my.blog_subcategory.category)]]\n ^\n","type":"parsing-error","line":1,"column":46,"id":0,"location":"query"
}
As soon as I add at least one blog_subcategory document which has a category value, the query returns the documents as expected.
I have also tested the above using the API Browser which results in the same behaviour.
Is the error response above expected behaviour?
button to show your support for the feature and check out our