esig / dss-demonstrations

Examples of DSS integration
GNU Lesser General Public License v2.1
95 stars 70 forks source link

[BUG] The openapi generation does not correctly generate the structure json for the property bytes #58

Closed p4535992 closed 6 months ago

p4535992 commented 6 months ago

I apologize, but I have tried I don't know how many times to create a ticket on JIRA, but it keeps telling me that I am being blocked for security reasons, so I am putting the ticket here, please resolve it quickly because I think it is a serious bug on the use of the rest api.

The openapi generation does not correctly generate the structure json for the property bytes:

https://ec.europa.eu/digital-building-blocks/DSS/webapp-demo/services/rest/certificate-validation/openapi.json

The following piece of code is wrong:

"bytes" : {
    "type" : "array",
    "items" : {
      "type" : "string",
      "format" : "byte"
    }
},

According to the swagger-spec (https://swagger.io/docs/specification/data-models/data-types/, section strings) It should look like this:

"bytes" : {
    "type" : "string",
    "format" : "byte"
},

A solution i found is to annotate the fields with this annotation (https://github.com/openapi-tools/swagger-maven-plugin/issues/22):

  @ApiModelProperty(dataType = "BYTE")
  public byte[] getBytes() {

Ty in advance and fpr your hard work.

bsanchezb commented 6 months ago

Hello,

Yes, we are aware about the issue. Please see the ticket https://ec.europa.eu/digital-building-blocks/tracker/browse/DSS-2444. It is a bug in swagger library.

The workaround with annotating the fields is not a solution, as DSS provides a generic Jakarta RESTful service (and same DTOs are used for SOAP), thus swagger-/openAPI-specific annotations cannot be applied there.

Best regards, Aleksandr

p4535992 commented 6 months ago

A ok i'll close the ticket ty for the fast response, really appreciate.