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
2025-02-23 18:29:31.649 ERROR 125971 RoutingContext : Unhandled exception in router
io.vertx.ext.web.handler.HttpException: Bad Request
Caused by: io.vertx.openapi.validation.SchemaValidationException: The value of query parameter phoneNumber is invalid. Reason: Instance type number is invalid. Expected string
at [email protected]/io.vertx.openapi.validation.SchemaValidationException.createInvalidValueParameter(SchemaValidationException.java:40)
at [email protected]/io.vertx.openapi.validation.SchemaValidationException.createErrorFromOutputUnitType(SchemaValidationException.java:65)
at [email protected]/io.vertx.openapi.validation.impl.RequestValidatorImpl.validateParameter(RequestValidatorImpl.java:135)
at [email protected]/io.vertx.openapi.validation.impl.RequestValidatorImpl.lambda$validate$2(RequestValidatorImpl.java:101)
at [email protected]/io.vertx.core.impl.WorkerPool$1.execute(WorkerPool.java:62)
at [email protected]/io.vertx.core.impl.WorkerTask.run(WorkerTask.java:57)
at [email protected]/io.vertx.core.impl.TaskQueue.run(TaskQueue.java:81)
at [email protected]/io.vertx.core.impl.ThreadPerTaskExecutorService.lambda$execute$0(ThreadPerTaskExecutorService.java:82)
at java.base/java.lang.VirtualThread.run(VirtualThread.java:329)
Caused by: io.vertx.json.schema.JsonSchemaValidationException: Instance type number is invalid. Expected string
at [#/type].<#>(Unknown Source)
I noticed that the issue is related to the fact that validateParameter calls ParameterTransformer#transform, that calls transformPrimitive, in which there is this piece of code:
If you notice, the string "+9999" does not match the regular expression, because "+" is not a "\w" character.
That causes it to fallback to Json.decodeValue("+9999"), that sees it as a Double, causing the error.
The text was updated successfully, but these errors were encountered:
Version
5.0.0.CR4
Context
I was testing my API, when I noticed that i encounter a SchemaValidationException when using strings that start with "+" in a query field.
Do you have a reproducer?
No
Steps to reproduce
Create an OpenAPI .yaml file with a field like this:
Then do the following request:
It will result in the following error:
I noticed that the issue is related to the fact that validateParameter calls ParameterTransformer#transform, that calls transformPrimitive, in which there is this piece of code:
If you notice, the string "+9999" does not match the regular expression, because "+" is not a "\w" character.
That causes it to fallback to Json.decodeValue("+9999"), that sees it as a Double, causing the error.
The text was updated successfully, but these errors were encountered: