In the example snippets below, path parameter “id” can be either an ID or username.
The developer uses the oneOf keyword to define the parameter.
But there’s a bug.
Can you spot it?
"parameters": [
{
"name": "id",
"in": "path",
"description": "The ID or username of the member",
"required": true,
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/ID"
},
{
"type": "string"
}
]
}
}
]
...
"components": {
"schemas": {
"ID": {
"type": "string",
"pattern": "^[0-9a-fA-F]{24}$"
}
}
}