Giter Club home page Giter Club logo

Comments (16)

refresz avatar refresz commented on August 15, 2024

Confirming this as well.

from dropwizard-swagger.

carminexx avatar carminexx commented on August 15, 2024

Just for information: you can make the application (and dropwizard-swagger) run, by NOT using SwaggerBundle, but instead a ViewBundle class that extends ViewBundle, and override the method that returns the configuration for views.

Example:

 // Add viewbundle with anon class
        bootstrap.addBundle(new ViewBundle<MyConfiguration>()
        {
            @Override
            public ImmutableMap<String, ImmutableMap<String, String>> getViewConfiguration(MyConfiguration myConf)
            {
                return myConf.getViewRendererConfiguration();
            }
        });

And, in you configuration.yml:

viewRendererConfiguration:
  .ftl:
    strict_syntax: yes
    whitespace_stripping: yes

And, again, in ExampleConfiguration.java, you must add:

    @NotNull
    private ImmutableMap<String, ImmutableMap<String, String>> viewRendererConfiguration = ImmutableMap.of();

@JsonProperty("viewRendererConfiguration")
    public ImmutableMap<String, ImmutableMap<String, String>> getViewRendererConfiguration() {
        return viewRendererConfiguration;
    }

    @JsonProperty("viewRendererConfiguration")
    public void setViewRendererConfiguration(Map<String, Map<String, String>> viewRendererConfiguration) {
        ImmutableMap.Builder<String, ImmutableMap<String, String>> builder = ImmutableMap.builder();
        for (Map.Entry<String, Map<String, String>> entry : viewRendererConfiguration.entrySet()) {
            builder.put(entry.getKey(), ImmutableMap.copyOf(entry.getValue()));
        }
        this.viewRendererConfiguration = builder.build();
    }

Hope this helps!

from dropwizard-swagger.

danieljamesscott avatar danieljamesscott commented on August 15, 2024

I have the same issue. What can I do to help get this working?

from dropwizard-swagger.

carminexx avatar carminexx commented on August 15, 2024

@danieljamesscott check my previous answer: #37 (comment)

from dropwizard-swagger.

dipalpat avatar dipalpat commented on August 15, 2024

Hi Carminexx,

I followed your post and did following changes -

1 - added snippet below in my application class in initialize method.

bootstrap.addBundle(new ViewBundle()
{
@OverRide
public ImmutableMap<String, ImmutableMap<String, String>> getViewConfiguration(ConferenceConfiguration myConf)
{
return myConf.getViewRendererConfiguration();
}
});

2 - added config in yml
3 - already there in my configuration class

I don't see the error anymore and can run the app fine. My issue is I do not see the swagger ui at http://localhost:8080/swagger

Can you please point me to missing link here?

from dropwizard-swagger.

alph486 avatar alph486 commented on August 15, 2024

I think this is a duplicate of #30

from dropwizard-swagger.

vultron81 avatar vultron81 commented on August 15, 2024

I made the necessary changes and created a pull request for Dropwizard v0.8.0 support.

from dropwizard-swagger.

alph486 avatar alph486 commented on August 15, 2024

@vultron81 nice 👍

from dropwizard-swagger.

carminexx avatar carminexx commented on August 15, 2024

@alph486 Maybe, but only from 0.8.0-rc2 and above. I used it with Dropwizard 0.8.0-rc1 and it worked, it broke only when I upgraded to 0.8.0. I don't know if the problem was also in 0.8.0-rc2/3/4.

@Dp1121 Have you checked the access log? It seems like a Jersey problem. How do you instantiate dropwizard-swagger in your main() ?

from dropwizard-swagger.

dipalpat avatar dipalpat commented on August 15, 2024

Thanks @vultron81 and @carminexx I am past the issue I was having.

from dropwizard-swagger.

sergiofagostinho avatar sergiofagostinho commented on August 15, 2024

Hi, I can't seem to use the workaround @carminexx provided. I followed the instructions and get the following when calling gradlew run:

Exception in thread "main" java.util.ServiceConfigurationError: io.dropwizard.views.ViewRenderer: Provider io.dropwizard.views.freemarker.FreemarkerViewRenderer could not be instantiated

Any ideas?

from dropwizard-swagger.

bdbull avatar bdbull commented on August 15, 2024

@Dp1121 how did you fix your error? I am able to get my app to run now, but can't see anything at /swagger either.

from dropwizard-swagger.

dipalpat avatar dipalpat commented on August 15, 2024

@bdbull I had missed adding swaggerDropwizard.onRun(configuration, environment,"localhost"); to run method within application class. HTH

from dropwizard-swagger.

bdbull avatar bdbull commented on August 15, 2024

@Dp1121 That was it...thanks!!!

from dropwizard-swagger.

federecio avatar federecio commented on August 15, 2024

It's great to see all this interaction going on!

Just FYI I deployed a new release with version 0.6 that provides support for DW 0.8 (thanks to @thiagomoretto and @vultron81 for the help). The README has been updated accordingly.

from dropwizard-swagger.

waldeilson-info avatar waldeilson-info commented on August 15, 2024

Hi, I can't seem to use the workaround @carminexx provided. I followed the instructions and get the following when calling gradlew run:

Exception in thread "main" java.util.ServiceConfigurationError: io.dropwizard.views.ViewRenderer: Provider io.dropwizard.views.freemarker.FreemarkerViewRenderer could not be instantiated

Any ideas?

How did you solve this issue?

from dropwizard-swagger.

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.