You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Querying a single element throws UNPROCESSABLE_ENTITY
{
"type": "https://stoplight.io/prism/errors#UNPROCESSABLE_ENTITY",
"title": "Invalid request",
"status": 422,
"detail": "Your request is not valid and no HTTP validation response was found in the spec, so Prism is generating this error for you.",
"validation": [
{
"location": [
"query",
"id"
],
"severity": "Error",
"code": "type",
"message": "Request query parameter id must be array"
},
{
"location": [
"query",
"id"
],
"severity": "Error",
"code": "anyOf",
"message": "Request query parameter id must match a schema in anyOf"
}
]
}
Expected Behavior
?id=1 should validate as an array, similar to unwrapped array.
Possible Workaround/Solution
One can query single array element with ?id[]=1 format.
The text was updated successfully, but these errors were encountered:
Arskah
changed the title
Array query parameters wrapped in anyOf do not work for single element arrays
Array query parameters wrapped in anyOf do not work for single element queries
Mar 13, 2025
If
array
query parameter is wrapped insideanyOf
, it does not behave similar to non-wrapped parameter when querying for single elements.https://github.com/Arskah/prism-anyof-single-array/blob/main/schema/api.json
Current Behavior
Querying a single element throws UNPROCESSABLE_ENTITY
Expected Behavior
?id=1
should validate as an array, similar to unwrapped array.Possible Workaround/Solution
One can query single array element with
?id[]=1
format.Steps to Reproduce
https://github.com/Arskah/prism-anyof-single-array
Repro steps in README.
Environment
stoplight/prism:5.12.1@sha256:271dc94c174a95d9c44b4a4e1b5eb335db1edb7ab88edb4cc9a2cbd7b210ef94
The text was updated successfully, but these errors were encountered: