question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

swagger.json not getting created.

See original GitHub issue

I am in a spring boot + jersey app, using this version of swagger.

        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-jersey2-jaxrs</artifactId>
            <version>1.5.6</version>
        </dependency>

I have read the docs, and configured swaggers as so:

@Configuration
public class AppConfig {
    @Configuration
    static class JerseyConfig extends ResourceConfig {
        public JerseyConfig() {
            register(MyResource.class);
            register(HealthCheckResource.class);
            configureSwagger();
        }

        private void configureSwagger() {
            register(ApiListingResource.class);
            register(SwaggerSerializers.class);
            BeanConfig beanConfig = new BeanConfig();
            beanConfig.setVersion(1.0);
            beanConfig.setSchemes(new String[]{"http"});
            beanConfig.setHost("localhost:9000");
            beanConfig.setBasePath("/api");
            beanConfig.setResourcePackage("com.my.resources");
            beanConfig.setPrettyPrint(true);
            beanConfig.setScan(true);
        }
    }
}

I have added @Api to the resource class, and I see swagger reading my resources in the logs. However, swagger.json is never created? Where do I go from here? I don’t see any errors.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
webroncommented, Feb 5, 2016

The swagger.json doesn’t generate a file on your file system. it’s just a resource like any other jax-rs resource you expose via jersey. the basePath doesn’t affect where the swagger.json is located, but it is the context root of your application (/test according to what you said?).

Based on that info, you should find it at http://localhost:9000/test/swagger.json

0reactions
kiran-headstrongcommented, Apr 2, 2018

I deployed swagger in wildfly server i am not able to see documentation.

Error: not able to read localhost:9090/projectname/swagger-ui.json

Read more comments on GitHub >

github_iconTop Results From Across the Web

ASP.NET Core - Swashbuckle not creating swagger.json file
1) Navigate to the localhost:xxxx/swagger · 2) Open Developer tools · 3) Click on the error shown in the console and you will...
Read more >
Swagger.json not generated · Issue #470 - GitHub
Swagger.json is all in memory. You'll never see a fire. It appears you're missing app.UseSwagger(); in Configure. You added the UI but not...
Read more >
Swagger.json file is not generated - Google Groups
swagger.json file is not generated under http://{localhost:8081}/Test and also not getting any error in console, everything processed properly.
Read more >
fetch error not found /swagger/v1/swagger.json - You.com
Your swagger end-point has the wrong Url, hence the 'Not Found' Error. Swagger documents constructed via the default way have their url in...
Read more >
Configuring and Using Swagger UI in ASP.NET Core Web API
GET THE BOOK <<. In the Configure() method, let's enable the middleware for serving the generated JSON document and the Swagger UI:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found