You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2021/09/18 22:06:00 UTC

[jira] [Commented] (OPENMEETINGS-2667) Generated swagger has incorrect response, missing root element in schema

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

ASF subversion and git services commented on OPENMEETINGS-2667:
---------------------------------------------------------------

Commit 4ed7cf0318a657b217382d311b26f842c4d7b4e6 in openmeetings's branch refs/heads/feature/OPENMEETINGS-2667-update-schema-definition-for-response-wrapping-in-root-element from Sebastian Wagner
[ https://gitbox.apache.org/repos/asf?p=openmeetings.git;h=4ed7cf0 ]

OPENMEETINGS-2667 Add ServiceResult updated schema wrapper to match CXF-RS response structure including root element.


> Generated swagger has incorrect response, missing root element in schema
> ------------------------------------------------------------------------
>
>                 Key: OPENMEETINGS-2667
>                 URL: https://issues.apache.org/jira/browse/OPENMEETINGS-2667
>             Project: Openmeetings
>          Issue Type: Improvement
>          Components: Documentation, SOAP/REST API
>    Affects Versions: 7.0.0
>            Reporter: Sebastian Wagner
>            Assignee: Sebastian Wagner
>            Priority: Major
>             Fix For: 7.0.0
>
>
> The way how CXF generates the JSON a response looks like this:
>  
> {code:java}
> {
>     "serviceResult": {
>         "message": "9f51e7d6-e662-463a-b410-7bf31357f111",
>         "type": "SUCCESS"
>     }
> }
> {code}
> It wraps it into a "serviceResult", while that part is not really part of the schema.
> Based on our API definition it would expect:
> {code:java}
> {
>     "message": "9f51e7d6-e662-463a-b410-7bf31357f111",
>     "type": "SUCCESS"
> }
> {code}
> => no wrapping into a "serviceResult": \{ ... } 
> There is a way to turn off this generation of wrapping / root elements in CXF. But that would break existing clients.
> So the challenge is to generate an API definition that actually matches the response.
> The only way to generate the correct documentation seems to be to wrap the schema class into a wrapper object so that the schema matches the generated and only supply that to the swagger annotation.
> Its not super nice. But it works for now. It would be better to drop the root / wrapping element on the long run. But that would be a breaking change to the API and probably require a new version.
>  
>  
>  
>  



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