I have a spring (boot) server and want to generate the openapi spec from the annotations with springdoc.
I have a request with two parameters in the request body. I want the first to be required and the second to be optional
@RequestBody(required = {true|false}) seems to only set all parameters in the body to (not) required.
The Javadoc for @Parameter on the other hand say to use io.swagger.v3.oas.annotations.parameters.RequestBody
This is my code that I would expect to generate a spec where the first Parameter is required and the second one is optional:
    @GetMapping("/fstVector")
    public ResponseEntity<Vector> fstV(@RequestBody final Vector v1, @RequestBody(required = false) final Vector v2) {
        return new ResponseEntity<>(v1, HttpStatus.OK);
    }
    
    @PostMapping("/fstVector")
    public ResponseEntity<Vector> fstVPost(@RequestBody(required = true) final Vector v1, @RequestBody(required = false) final Vector v2) {
        return new ResponseEntity<>(v1, HttpStatus.OK);
    }
The generated spec however has both parameters required:
  /pond/fstVector:
    get:
      tags:
      - circle-escape-controller
      operationId: fstV
      parameters:
      - name: v1
        in: query
        required: true
        schema:
          $ref: '#/components/schemas/Vector'
      - name: v2
        in: query
        required: true
        schema:
          $ref: '#/components/schemas/Vector'
      responses:
        "200":
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Vector'
    post:
      tags:
      - circle-escape-controller
      operationId: fstVPost
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                v1:
                  $ref: '#/components/schemas/Vector'
                v2:
                  $ref: '#/components/schemas/Vector'
        required: true
      responses:
        "200":
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Vector'
How can I require only a specific parameter for all four request types?
 
     
    

 
    