eclipse-vertx/vertx-openapi

Integer in String-typed path parameter seen as invalid

thced opened this issue · 0 comments

thced commented

Version

4.4.1

Context

Given a request to a path similar to this:

http://localhost:8080/api/v1/config/SE/111

The path in spec looks like:

/config/{countryCode}/{uniqueId}:
  get:
    summary: Some summary
    description: Some desc
    operationId: the-op
    parameters:
      - $ref: '#/components/parameters/countryCode'
      - $ref: '#/components/parameters/uniqueId'

And a component section as:

components:
  parameters:
    countryCode:
      in: path
      name: countryCode
      schema:
        type: string
        pattern: '[A-Z]{2}'
      required: true
      description: The ISO 3166-1 2-alpha country code.
    uniqueId:
      in: path
      name: uniqueId
      schema:
        type: string
      required: true
      description: The id

The mentioned URL breaks with the following exception:

DEBUG i.v.e.w.RoutingContext - RoutingContext failure (500)
io.vertx.openapi.validation.ValidatorException: The value of path parameter uniqueId is invalid. Reason: Instance type number is invalid. Expected string
	at io.vertx.openapi.validation.ValidatorException.createInvalidValue(ValidatorException.java:70)
	at io.vertx.openapi.validation.impl.RequestValidatorImpl.validateParameter(RequestValidatorImpl.java:132)
	at io.vertx.openapi.validation.impl.RequestValidatorImpl.lambda$null$2(RequestValidatorImpl.java:99)
	at io.vertx.core.impl.ContextBase.lambda$null$0(ContextBase.java:137)
	at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264)
	at io.vertx.core.impl.ContextBase.lambda$executeBlocking$1(ContextBase.java:135)
	at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: io.vertx.json.schema.JsonSchemaValidationException: Instance type number is invalid. Expected string