Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path parameter format uuid fails #84

Open
re-thc opened this issue Oct 6, 2024 · 2 comments
Open

Path parameter format uuid fails #84

re-thc opened this issue Oct 6, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@re-thc
Copy link

re-thc commented Oct 6, 2024

Version

4.5.10

Context

Setting a path parameter of type: string and format: uuid never works. Removing the format works.

The message always returns: The value of path parameter id is invalid. Reason: String does not match format \"uuid\"

io.vertx.openapi.validation.SchemaValidationException: The value of path parameter id is invalid. Reason: String does not match format "uuid" at io.vertx.openapi.validation.SchemaValidationException.createInvalidValueParameter(SchemaValidationException.java:39) 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.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:191) at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:270) at io.vertx.core.impl.ContextImpl.lambda$internalExecuteBlocking$2(ContextImpl.java:210) at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)

Do you have a reproducer?

  • Setup vertx
  • OpenAPI doc
  • Run vertx
@re-thc re-thc added the bug Something isn't working label Oct 6, 2024
@re-thc re-thc changed the title Format uuid fails Path parameter format uuid fails Oct 6, 2024
@CheesyBoy123
Copy link
Contributor

CheesyBoy123 commented Oct 10, 2024

Hey @re-thc thanks for the report. Can you pass a sample UUID that is failing? They should all be checked against this regex https://github.com/eclipse-vertx/vertx-json-schema/blob/4.x/src/main/java/io/vertx/json/schema/impl/Format.java#L85. Im wondering if the regex is potentially wrong here. Also, if this is something you are willing to dog into I can help point you in the right direction 🙂

Thanks!

@CheesyBoy123
Copy link
Contributor

Hey @re-thc
I am not able to reproduce this at all, can you please send me a sample openapi spec that you have or let me know what you are doing?

"/uuid/{uuid}": {
      "get": {
        "summary": "Info for a specific pet",
        "operationId": "showPetByUUID",
        "tags": [
          "pets"
        ],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "description": "The uuid of the pet to retrieve",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Expected response to a valid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pet"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "default": {
            "description": "unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }

This is what I have and I have tested against various UUIDs

createRequest(HttpMethod.GET, "/uuid/" + UUID.randomUUID())

They are all passing without any problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants