Code Monkey home page Code Monkey logo

Comments (10)

Miamoto-Musashi avatar Miamoto-Musashi commented on May 14, 2024

Any news about it?
i have all my REST services under http://localhost/rest/\* and i cannot document any of them.

thanks

from springfox.

ankurvsoni avatar ankurvsoni commented on May 14, 2024

Same here. Any updates on this?

from springfox.

dilipkrish avatar dilipkrish commented on May 14, 2024

@ankurvsoni @Miamoto-Musashi This issue should be fixed now. Do let me know if it doesnt work for you.

from springfox.

ankurvsoni avatar ankurvsoni commented on May 14, 2024

@dilipkrish will check it out. Is there an official version where the fix is available?

from springfox.

martypitt avatar martypitt commented on May 14, 2024

Version 0.3.0 has just been released, should sync to maven central shortly.

Please test, and close this bug if resolved.

from springfox.

ankurvsoni avatar ankurvsoni commented on May 14, 2024

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.(HashMap.java:320)
at com.google.common.collect.Maps.newHashMap(Maps.java:144)
at com.mangofactory.swagger.ControllerDocumentation.getModels(ControllerDocumentation.java:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.get(BeanPropertyWriter.java:653)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:509)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:551)
... 42 more

Not sure what might be causing this?

from springfox.

dilipkrish avatar dilipkrish commented on May 14, 2024

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}"/>












from springfox.

ankurvsoni avatar ankurvsoni commented on May 14, 2024

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!

from springfox.

dilipkrish avatar dilipkrish commented on May 14, 2024

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.

from springfox.

dilipkrish avatar dilipkrish commented on May 14, 2024

This bug should be fixed

from springfox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.