-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Add bean validation annotations for the method parameters which are treated as headers #10555
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
base: master
Are you sure you want to change the base?
Add bean validation annotations for the method parameters which are treated as headers #10555
Conversation
…reated as headers
f7907ce
to
c43eef3
Compare
I ran into a similar issue this week with Request Header validations. Happy to see someone has started to look into it already. In trying your update to modules/openapi-generator/src/main/resources/JavaSpring/headerParams.mustache I ran into a couple of issues. Hoping you can validate these.
One thing that I tried, which may address the issues, is to change the following section in
to:
This will apply the |
Using the |
In the case where the specification of the header has a schema type of object instead of a primitive we will need the @Valid annotation. I am thinking that the I would include a part of the specification that includes a header with object type and ensure @Valid is attached to that. Maybe add to the schema something like this: - name: requiredObjectWithStringOfLength
in: header
required: true
schema:
type: object
required:
- aString
properties:
aString:
type: string
minLength: 32
maxLength: 32 |
2bc51b6
to
b3990ba
Compare
Hi, is there any progress on that pull-request? |
@valery1707 can you please resolve the merge conflicts when you've time? |
cc @cachescrubber (2022/02) @welshm (2022/02) @MelleD (2022/02) @atextor (2022/02) @manedev79 (2022/02) @javisst (2022/02) @borsch (2022/02) @banlevente (2022/02) |
I'd love to see this integrated! It would save us having to maintain a customized mustache template for header parameters. Thanks for the PR! |
@valery1707 can you please resolve the merge conflicts when you've time? |
Bean validation annotations are not generated for the method parameters which are treated as headers.
Resolve #7125
PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.For Windows users, please run the script in Git BASH.
master
(5.3.0),6.0.x
@nmuesch