Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Howto programatically configure Swagger for @BeanParam support #2130

Closed
dpeger opened this issue Mar 7, 2017 · 1 comment
Closed

Howto programatically configure Swagger for @BeanParam support #2130

dpeger opened this issue Mar 7, 2017 · 1 comment

Comments

@dpeger
Copy link
Contributor

dpeger commented Mar 7, 2017

Hi,

I got some services that are using @BeanParam parameters (using CXF) and wanted to add these services to swagger. Following #446 I added swagger-jersey2-jaxrs_2.11 to my build (version 1.3.12). In #446 it is said that one needs to use the com.wordnik.swagger.jersey.config.JerseyJaxrsConfig servlet. However I'm using Spring and configure swagger in a @Configuration class using com.wordnik.swagger.jaxrs.config.BeanConfig. I already added the Jersey variants of ResourceListingProvider and ApiDeclarationProvider, like this

@Bean("resourceWriter")
public ResourceListingProvider swaggerResourceListingProvider()
{
  return new JerseyResourceListingProvider();
}

@Bean("apiWriter")
public ApiDeclarationProvider swaggerApiDeclarationProvider()
{
  return new JerseyApiDeclarationProvider();
}

But this doesn't work. In swagger-ui the corresponding BeanParameter is shown as body parameter but it actually contains two PathParameters.

This is what my bean looks like:

public final class ApplicationIdentifierParameter
{

  private String mApplicationId;

  private String mProjectId;

  public String getApplicationId()
  {
    return mApplicationId;
  }

  @ApiParam(value = "Application type", required = true)
  @PathParam("applicationId")
  public void setApplicationId(String aApplicationId)
  {
    mApplicationId = aApplicationId;
  }

  public String getProjectId()
  {
    return mProjectId;
  }

  @ApiParam(value = "Application type", required = true)
  @PathParam("projectId")
  public void setProjectId(String aProjectId)
  {
    mProjectId = aProjectId;
  }
}
@webron
Copy link
Contributor

webron commented Mar 7, 2017

You followed a ticket from over 3 years ago, instead of checking the wiki for actual documentation on how to integrate swagger-core with your code. You're using an ancient version of the project which is no longer supported. Try using the latest first, and if you still have issues, open a new ticket.

@webron webron closed this as completed Mar 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants