F
F
Floor is Java2022-04-04 16:12:21
Java
Floor is Java, 2022-04-04 16:12:21

Openapi (Swagger) Generator. How to generate a method that takes an HttpServletResponse as a parameter?

Good afternoon.

I describe the specification. Design first.
Those. according to the described specification, the code of controllers and DTO will be generated.

It is not possible to describe the method in such a way that HttpServletResponse is the parameter.

/api/method:
    get:
      tags:
        - XXXController
      summary: ~
      description: ~
      operationId: doSomething
      parameters:
        - description: HttpServletResponse
          in: query
          name: response
          required: true
          schema:
            $ref: '#/components/schemas/HttpServletResponse'


I have an alias for HttpServletResponse described in build.gradle. I pass it through $ref above:

importMappings = [
                     HttpServletResponse: "javax.servlet.http.HttpServletResponse"
    ]


But I can't. Gives an error message:
Errors: 
  -attribute paths.'/method/l'(get).parameters.[response].schemas.#/components/schemas/HttpServletResponse is missing


At the same time, if I throw this "HttpServletResponse" entity mapped into components, then it sees fine.
And as a parameter of the method does not want to see.

As a method parameter, an entity from components is passed, which is actually described there (in yaml), but the one that is passed by reference to an existing class does not want to work

. What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
yamakasi_habr, 2022-04-04
@yamakasi_habr

Sorry, I don't know, I'm programming in another language

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question