Closed martypitt closed 11 years ago
Same here. Any updates on this?
@ankurvsoni @Miamoto-Musashi This issue should be fixed now. Do let me know if it doesnt work for you.
@dilipkrish will check it out. Is there an official version where the fix is available?
Version 0.3.0 has just been released, should sync to maven central shortly.
Please test, and close this bug if resolved.
I see /api-docs and /api-docs/\ mapped. /api-docs works fine. But if I try to access one of my api's i.e. /api-docs/api/pets - I get:
Caused by: java.lang.IllegalArgumentException: Class org.springframework.web.util.UriComponentsBuilder would not be serialized as a JSON object and therefore has no schema
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.generateJsonSchema(DefaultSerializerProvider.java:260)
at com.fasterxml.jackson.databind.ObjectMapper.generateJsonSchema(ObjectMapper.java:2539)
at com.mangofactory.swagger.ControllerDocumentation$1.apply(ControllerDocumentation.java:84)
at com.mangofactory.swagger.ControllerDocumentation$1.apply(ControllerDocumentation.java:76)
at com.google.common.collect.Maps$2.transformEntry(Maps.java:1252)
at com.google.common.collect.Maps$TransformedEntriesMap$1$1$1.getValue(Maps.java:1542)
at java.util.HashMap.putAllForCreate(HashMap.java:534)
at java.util.HashMap.
Not sure what might be causing this?
Most likely you have UriComponentsBuilder as a method parameter which isn't really a model and we cannot infer the schema. Try adding UriComponentsBuilder to the ignorableParameterTypes collection to the swagger configuration extension bean … I think that should fix your problem
Example below:
<bean id="swaggerConfiguration" class="com.mangofactory.swagger.SwaggerConfiguration">
<property name="basePath" value="${service.documentation.base-url}"/>
…
…
Thanks. With minor modification I was able to get this working. However, I see another issue - When I access
http://localhost:8080/example-service/api-docs - I get:
{"apiVersion":"1.0","swaggerVersion":"1.0","basePath":"http://localhost:8080/example-service","apis":[{"path":"/api-docs/api/examples"}]}
But for - http://localhost:8080/example-service/api-docs/api/examples - I get:
{"apiVersion":"1.0","swaggerVersion":"1.0","basePath":"http://localhost:8080/example-service","resourcePath":"api/examples","models":{}}
I don't any "apis" here. Any ideas why?
Thanks!
Thats not enough information for me to tell whats going on. Possibly your controller methods do not have a request mapping annotation? May be posting your controller class might help. In any case, If your original problem has been fixed please move to close this open bug and open a new bug for the scenario you're now having.
This bug should be fixed
Any news about it? i have all my REST services under http://localhost/rest/* and i cannot document any of them.
thanks