Skip to content
This repository has been archived by the owner on Oct 21, 2020. It is now read-only.

using Swagger.writeSwagger #7

Open
elirazBusi opened this issue Jan 6, 2015 · 3 comments
Open

using Swagger.writeSwagger #7

elirazBusi opened this issue Jan 6, 2015 · 3 comments

Comments

@elirazBusi
Copy link

Hi
I am using the following code in order to add api declaration without using annotations:
ResourceListing resourceListing = null;

        resourceListing = Swagger.createResourceListing(SwaggerVersion.DEFAULT_VERSION);

        resourceListing.setBasePath("http://localhost:8080/Spring/rest");
        SwaggerFactory factory = Swagger.createSwaggerFactory();

        ApiDeclaration apiDeclaration = factory.createApiDeclaration("http://localhost:8080/Spring/rest", "/bookmarks");
        Api api = apiDeclaration.addApi("/bookmarks");//the request url that is being called
        Operation operation = api.addOperation("getBookmarks",Operation.Method.GET);
        operation.setSummary("bookmarks list");
        operation.addProduces("application/atom+xml");


        resourceListing.addApi( apiDeclaration, "/bookmarks" );
        Swagger.writeSwagger(resourceListing, "src/main/webapp");

now, after performing Swagger.writeSwagger I do get api-docs.json and bookmarks.json files under "src/main/webapp" as, But- when I access in the Swagger-ui to the resource "http://localhost:8080/Spring/rest/api-docs" I can't get the bookmarks resource. so my question is how to integrate the jsons file I got from swaggerWriter into the api-docs resource that is generated by the swagger-core.

I will really appreciate your help here!!!

@olensmar
Copy link
Contributor

Hi!

sorry for the delay here - can you show the contents of the generated api-docs.json file?

thanks,

/Ole

@elirazBusi
Copy link
Author

Hi Ole, thank you for your response, I already got arranged. I simply created a new resource, parallel to /api-docs swagger's resource, providing the appropriate json file

@olensmar
Copy link
Contributor

ok great - I'm sorry I wasn't of any help earlier...

/Ole

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants