@APiModelProperty annotation (hidden = true) don't work with other annotations

1,152 views
Skip to first unread message

Ritwick Gupta

unread,
Apr 15, 2014, 6:03:05 PM4/15/14
to swagger-sw...@googlegroups.com
In my annotations, hidden = true doesn't work if I combine it with other annotations like Xml annotations. For example  

  @XmlElementWrapper(name="order_specials")
    @XmlElement(name="order_special")
    @ApiModelProperty(hidden = true)
    public List<SpecialOrderItem> getOrder_specials() {
        return order_specials;
    }


the List variable "order_specials" should not be displayed in the swagger docs but it is. When I remove the xml annotations and make it 

    @ApiModelProperty(hidden = true)
    public List<SpecialOrderItem> getOrder_specials() {
        return order_specials;
    }

it works properly. Weirdly I also tried

   @XmlElementWrapper(name="order_specials")
    @XmlElement(name="order_special")
    @ApiModelProperty(hidden = true, value = "check")
    public List<SpecialOrderItem> getOrder_specials() {
        return order_specials;
    }

This displays value as "check" in swagger doc, but doesn't hide the variable. Any idea/solution? 

Ron

unread,
Apr 16, 2014, 7:17:17 AM4/16/14
to swagger-sw...@googlegroups.com
You can try setting the @ApiModelProperty on the setter method or the field itself and see if it works.
If not, feel free to open an issue about it on swagger-core.


--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ritwick Gupta

unread,
Apr 16, 2014, 12:02:33 PM4/16/14
to swagger-sw...@googlegroups.com
Tried it. Doesn't work.

Also, how can I open an issue on swagger-core? 
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

Ron

unread,
Apr 16, 2014, 12:04:06 PM4/16/14
to swagger-sw...@googlegroups.com


To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages