quarkus-openapi-generator icon indicating copy to clipboard operation
quarkus-openapi-generator copied to clipboard

Bean validation not working

Open krisraich opened this issue 1 year ago • 1 comments

Hello

It seems that server side bean validation is ignored. YML Schema:

    UserCredentials:
      type: object
      required:
        - userName
        - password
      properties:
        userName:
          type: string
        password:
          type: string

Beans

    /**
     * 
     * (Required)
     * 
     */
    @JsonProperty("userName")
    private String userName;
    /**
     * 
     * (Required)
     * 
     */
    @JsonProperty("password")
    private String password;

A request that is missing a parameter should yield HTTP Code 400

Is there a configuration or package that I have overlooked?

krisraich avatar Nov 13 '24 09:11 krisraich

@ricardozanini @hbelmiro This is being labeled as Stale.

github-actions[bot] avatar Jan 13 '25 12:01 github-actions[bot]

@ricardozanini @hbelmiro This is being labeled as Stale.

github-actions[bot] avatar Mar 15 '25 12:03 github-actions[bot]

@ricardozanini @hbelmiro This is being labeled as Stale.

github-actions[bot] avatar May 19 '25 12:05 github-actions[bot]

It should be solved by this pull request https://github.com/Apicurio/apicurio-codegen/pull/345! Let's wait a little more :)

mcruzdev avatar Jun 19 '25 17:06 mcruzdev

@ricardozanini @hbelmiro This is being labeled as Stale.

github-actions[bot] avatar Aug 19 '25 12:08 github-actions[bot]

@mcruzdev has this one been solved already?

ricardozanini avatar Aug 19 '25 19:08 ricardozanini

Yes @ricardozanini, we can close this one.

@krisraich, please, use the quarkus.openapi-generator.use-bean-validation property to enable this one.

mcruzdev avatar Aug 30 '25 19:08 mcruzdev

Hi!

Thanks for the update!

I've updated the quarkus-openapi-generator-server dependency to 2.12.0 and set quarkus.openapi.generator.use-bean-validation to true. However, it does not seem to make any difference. I've also added quarkus-hibernate-validator... Still no Jakarta Valid annotation on the resource interfaces or beans. The x-codegen-annotations works fine though.

Also, x-codegen-contextRoot seems not to be working.

krisraich avatar Aug 31 '25 21:08 krisraich

I finally figured it out.. The configuration key is different as what is stated in the documentation. But it is fixed now with 2.12.1.

Validation works now like a charm 👍

krisraich avatar Sep 17 '25 15:09 krisraich

Hello,

I used 2.13.0-lts and quarkus.openapi.generator.use-bean-validation=true did not work for me. I had to change it to quarkus.openapi.generator.bean-validation=true.

However I am confused since the doc update on 2.12.1 changed it from bean-validation to use-bean-validation. Is this a regression?

crazybolillo avatar Nov 09 '25 04:11 crazybolillo

Yea, it seems to be quarkus.openapi.generator.bean-validation=true It is also wrong in the docs at https://docs.quarkiverse.io/quarkus-openapi-generator/dev/server.html#quarkus-openapi-generator-server_quarkus-openapi-generator-use-bean-validation

fayeinmay avatar Nov 16 '25 22:11 fayeinmay

cc @mcruzdev

ricardozanini avatar Nov 17 '25 14:11 ricardozanini