You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Luca Leonardo Scorcia (Jira)" <ji...@apache.org> on 2021/04/27 00:23:00 UTC
[jira] [Created] (CXF-8530) Error in OpenAPI descriptor for byte
array properties
Luca Leonardo Scorcia created CXF-8530:
------------------------------------------
Summary: 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
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)