Swagger annotations on Interfaces

330 views
Skip to first unread message

Nataly Castillo

unread,
Feb 3, 2014, 10:47:53 AM2/3/14
to swagger-sw...@googlegroups.com
Hi everyone,

I'm using swagger inside a maven project to document REST services.

Inside the REST services I had  an interface with this configuration:

@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.PROPERTY, property="@type")
@JsonSubTypes({
        @JsonSubTypes.Type(value=RestDataSource.class, name="rest")
})
public interface DataSource {
}

And this implementation :

@JsonTypeName("rest")
public class RestDataSource implements DataSource {

    @ApiProperty(required = true, notes = " It is the url of the service.")
    private String urlResource;

}

I want to document it. Hence , I would like to know how to use annotations on Interfaces with swagger? Is there any specific annotation to management it?

Thank you for your help.

Best regards.

tony tam

unread,
Feb 3, 2014, 7:05:23 PM2/3/14
to swagger-sw...@googlegroups.com
Hi Nataly, it is true that the standard model processing in swagger-core does not find annotations on interfaces.  I was told, though, that by using this technique:


that the reflections.org library (used internally) will find them.  I'd suggest giving that a shot.

Nataly Castillo

unread,
Feb 4, 2014, 8:28:06 AM2/4/14
to swagger-sw...@googlegroups.com
Hi tony,

Thank you for your response. 

However, I can't figure out it because I'm using the maven plugin and reflections.org  is for sale .

Ron

unread,
Feb 4, 2014, 9:49:36 AM2/4/14
to swagger-sw...@googlegroups.com
Nataly, tony meant https://github.com/ronmamo/reflections which the author chose to call reflections.org.


--
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/groups/opt_out.

Nataly Castillo

unread,
Feb 4, 2014, 11:17:08 AM2/4/14
to swagger-sw...@googlegroups.com
Thanks Ron, that help me to realize what he meant :). 

best regards


El lunes, 3 de febrero de 2014 10:47:53 UTC-5, Nataly Castillo escribió:
Reply all
Reply to author
Forward
0 new messages