Forum Discussion

BenjaminJelli's avatar
BenjaminJelli
Regular Visitor
4 years ago
Solved

Specifying Encoding For Form Data Parameters

Hello,

 

My question is specific to jaxrs2 integration and could be summarised as the following:

"What does the path look like to fleshing out jaxrs2 integration such that it can be used to generate all aspects of the OpenAPI 3.0 specification, esp. with regards to its priority relative to other aspects of the Swagger Core project?"

 

The rest is a specific example of functionality missing in jaxrs2 integration, including my initial efforts to implement that functionality in the swagger-jaxrs2 module.

 

I've come to understand that swagger-jaxrs2 can handle turning method parameters annotated FormParam into the appropriate request body in the resulting specification. My problem comes from not being able to specify the encoding on the parameters as this document indicates in the "Form Data" section.

 

The Swagger UI project compounds this problem by not using the correct default serialisation for form parameter arrays ("correct" according to the same document linked above).

 

I implemented a proof of concept pull request for a way to specify request body encoding in these circumstances by specifying the encoding on the RequestBody annotation on the method. From my exploration it seemed that allowing this type of customisation via a Parameter annotation on each parameter would have increased the complexity greatly unless the code for processing parameters annotated with FormParam itself was more largely re-examined.

 

If there is some way to do this already then some guidance towards that solution (and the documentation for it) would be greatly appreciated.

  • Hi,

     

    I am not sure I fully understand what you mean with:

     

    "What does the path look like to fleshing out jaxrs2 integration such that it can be used to generate all aspects of the OpenAPI 3.0 specification, esp. with regards to its priority relative to other aspects of the Swagger Core project?"

     

    But if I get this right you are looking for some refactor of the module to better handle processing/resolving; while this would be indeed good, we don't have planned it for short term, as always any help is more then welcome.

     

    For your specific question/comment, many thanks for the PR providing a possible solution; this has been replaced by https://github.com/swagger-api/swagger-core/pull/3696 which adds support for `@Parameter` resolving, please give it a try and see if it solves your issue (if not, please add comments/follow ups to https://github.com/swagger-api/swagger-core/issues/3643)

1 Reply

  • Hi,

     

    I am not sure I fully understand what you mean with:

     

    "What does the path look like to fleshing out jaxrs2 integration such that it can be used to generate all aspects of the OpenAPI 3.0 specification, esp. with regards to its priority relative to other aspects of the Swagger Core project?"

     

    But if I get this right you are looking for some refactor of the module to better handle processing/resolving; while this would be indeed good, we don't have planned it for short term, as always any help is more then welcome.

     

    For your specific question/comment, many thanks for the PR providing a possible solution; this has been replaced by https://github.com/swagger-api/swagger-core/pull/3696 which adds support for `@Parameter` resolving, please give it a try and see if it solves your issue (if not, please add comments/follow ups to https://github.com/swagger-api/swagger-core/issues/3643)