Since version 1.0.46, we found that if the invalid json is not the first in the oneOf choice list, the error message is not right.
For an example, if the schema is like below:
oneOf:
- $ref: '#/components/schemas/SearchByEmail'
- $ref: '#/components/schemas/SearchByPartialName'
- $ref: '#/components/schemas/SearchByPhone'
The SearchByPartialName's definition is like below:
SearchByPartialName:
type: object
additionalProperties: false
properties:
byPartialName:
type: object
required:
- partialName
properties:
partialName:
type: string
nullable: true
maxLength: 70
minLength: 1
If the json message has partialName exceeds 70 chars like below:
{
"search": {
"byPartialName": {
"partialName": "aabbccddaabbccddaabbccddaabbccddaabbccddaabbccddaabbccddaabbccddaabbccddaabbccdd"
}
}
}
The error message is wrong: Schema Validation Error - requestBody.search.byPartialName: is not defined in the schema and the schema does not allow additional properties
However, if SearchByPartialName is the first in the oneOf list. the error message becomes correct. Schema Validation Error - requestBody.search.byPartialName.partialName: may only be 70 characters long
Since version
1.0.46, we found that if the invalid json is not the first in theoneOfchoice list, the error message is not right.For an example, if the schema is like below:
The
SearchByPartialName's definition is like below:If the json message has
partialNameexceeds 70 chars like below:{ "search": { "byPartialName": { "partialName": "aabbccddaabbccddaabbccddaabbccddaabbccddaabbccddaabbccddaabbccddaabbccddaabbccdd" } } }The error message is wrong:
Schema Validation Error - requestBody.search.byPartialName: is not defined in the schema and the schema does not allow additional propertiesHowever, if
SearchByPartialNameis the first in theoneOflist. the error message becomes correct.Schema Validation Error - requestBody.search.byPartialName.partialName: may only be 70 characters long