Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

swagger - org.openapi.generator issue for 302 using openapi 3 and spring boot

I have swagger definition file having the below snippet for POST request

       parameters:
         - name: responseXML
           in: query
           required: true
           schema:
             type: string
      responses:
        '302':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TestResponse'

I'm using gradle plugin 'org.openapi.generator' version '4.3.1' to auto generate the spring boot REST API

Here is the auto generated code snippet

@ApiResponses(value = { 
        @ApiResponse(code = 302, message = "successful operation", response = TestResponse.class) })
    @RequestMapping(value = "/public/v1/test",
        produces = { "application/json" }, 
        method = RequestMethod.POST)
    default ResponseEntity<Void> testResponse() {
        return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);

    }

but it is generating ResponseEntity<Void>, I was expecting ResponseEntity<TestResponse>.

is there way to achieve this?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...