You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2015/07/09 13:26:04 UTC

[jira] [Commented] (CAMEL-7941) Expose private variables as JSON for camel-swagger

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

Claus Ibsen commented on CAMEL-7941:
------------------------------------

You should do it on the getter/setter like this
https://github.com/apache/camel/blob/master/examples/camel-example-servlet-rest-tomcat/src/main/java/org/apache/camel/example/rest/User.java#L36

> Expose private variables as JSON for camel-swagger
> --------------------------------------------------
>
>                 Key: CAMEL-7941
>                 URL: https://issues.apache.org/jira/browse/CAMEL-7941
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-swagger
>    Affects Versions: 2.14.0
>            Reporter: Espen Tjonneland
>            Priority: Minor
>
> Consider the following class:
> @ApiModel(value = "MyDTO ", description = "My data transporter") 
> public class MyDTO { 
>     @ApiModelProperty(value = "This is a private field") 
>     private String myPrivateField; 
> } 
> Swagger will not document the class as JSON. I am unsure if this is happening in camel-core, or if this is a problem with Swagger. However, the behavior is inconsistent with e.g. Gson, which handles private fields just fine. Instead it relies on annotations for how the class variables should be exposed. 
> Would it be possible to have this variable exposed by default even though it is private, and instead rely on annotations for deciding how to expose the variables (like Gson does).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)