You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Andriy Redko (Jira)" <ji...@apache.org> on 2021/04/27 00:42:00 UTC

[jira] [Comment Edited] (CXF-8530) Error in OpenAPI descriptor for byte array properties

    [ https://issues.apache.org/jira/browse/CXF-8530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17332820#comment-17332820 ] 

Andriy Redko edited comment on CXF-8530 at 4/27/21, 12:41 AM:
--------------------------------------------------------------

Hey [~l.scorcia] , this is Swagger Core issue (the JAX-RS part), not CXF, see please [1]. You should be able to add the Swagger OpenAPI annotations to clarify the desired intent, thanks.

[1] [https://github.com/swagger-api/swagger-core/issues/3511]


was (Author: reta):
Hey [~l.scorcia] , this is Swagger Core issue (the JAX-RS part), not CXF, see please [1], thanks

[1] https://github.com/swagger-api/swagger-core/issues/3511

> Error in OpenAPI descriptor for byte array properties
> -----------------------------------------------------
>
>                 Key: CXF-8530
>                 URL: https://issues.apache.org/jira/browse/CXF-8530
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 3.4.3
>            Reporter: Luca Leonardo Scorcia
>            Priority: Major
>         Attachments: repro.patch
>
>
> When using OpenAPIFeature to generate the OpenAPIv3 description document for a CXF web service, the built-in type mapper generates a wrong output in the JSON document.
> For repro, take the example project at [https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jax_rs/description_openapi_v3_web] and add a byte[] property to the Item class, like in the attached patch file.
> Run the project and scroll to the end of the generated json document at [http://localhost:9000/app/openapi.json]:
> {{"components" : {}}
>  {{  "schemas" : {}}
>  {{    "Item" : {}}
>  {{      "type" : "object",}}
>  {{      "properties" : {}}
>  {{         "name" : {}}
>  {{            "type" : "string"}}
>  {{         },}}
>  {{         "value" : {}}
>  {{            "type" : "string"}}
>  {{         },}}
>  {{         {color:#ff0000}"binary" : {{color}}}
>  {{{color:#ff0000}           "type" : "array",{color}}}
>  {{{color:#ff0000}           "items" : {{color}}}
>  {{{color:#ff0000}             "type" : "string",{color}}}
>  {{{color:#ff0000}             "format" : "byte"{color}}}
>  {{{color:#ff0000}           }{color}}}
>  {{{color:#ff0000}         }{color}}}
>          }
>        }
>      }
>  }
> This is interpreted by OpenAPI codegen tools as a List of byte[].
> According to the OpenAPIv3 spec, byte arrays should actually be represented as
> {
>      "type": "string",
>      "format": "byte"
> }
> without the "type": "array" wrapper.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)