title: CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES not reflected in swagger.json
body: <p>I am using Jersey, Jax-rs and swagger (+ Spring for injection). My objects have some members and embedded objects with names that are composed of more than one word, and in code I use camelCase. 
  I defined a resolver so they are emitted as underscore as per standard convention. The problem is that swagger apparently doesn't pick up this resolver, so that the objects still appear as camelCase in the swagger json. </p>
  
  <p>Below are some details of my specific configuration:</p>
  
  <p>Snippets of my pom.xml:</p>
  
  <pre><code>&lt;properties&gt;
          &lt;springframework.version&gt;4.2.3.RELEASE&lt;/springframework.version&gt;
          &lt;glassfish.jersey.version&gt;2.22.1&lt;/glassfish.jersey.version&gt;
      &lt;/properties&gt;
  &lt;dependencies&gt;
  </code></pre>
  
  <p>......</p>
  
  <pre><code>&lt;!-- Jersey --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
              &lt;version&gt;3.1.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-container-servlet&lt;/artifactId&gt;
              &lt;version&gt;${glassfish.jersey.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.core&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-server&lt;/artifactId&gt;
              &lt;version&gt;${glassfish.jersey.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.core&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-client&lt;/artifactId&gt;
              &lt;version&gt;${glassfish.jersey.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-media-json-jackson&lt;/artifactId&gt;
              &lt;version&gt;${glassfish.jersey.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
  &lt;!-- swagger documentation --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;io.swagger&lt;/groupId&gt;
              &lt;artifactId&gt;swagger-jersey2-jaxrs&lt;/artifactId&gt;
              &lt;version&gt;1.5.0&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>.....</p>
  
  <pre><code>&lt;/dependencies&gt;
  </code></pre>
  
  <p>I am using annotations only, so my web.xml is empty and I have an AppInitializer class. The Swagger servlet is initialized in the class</p>
  
  <pre><code>public class AppInitializer implements WebApplicationInitializer {
  
      public void onStartup(ServletContext container) throws ServletException {
  
          AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
          ctx.register(MongoDbConfig.class);
          ctx.register(CORSResponseFilter.class);
          ctx.setServletContext(container);
  
          container.addListener(new ContextLoaderListener(ctx));
          container.addListener(new RequestContextListener());
  
          ServletRegistration.Dynamic servlet = container.addServlet("jersey-servlet",
                  new org.glassfish.jersey.servlet.ServletContainer());
          servlet.setInitParameter("jersey.config.server.provider.packages", "io.swagger.jaxrs.listing,com.my.server.config,com.my.server.resource");
          servlet.setLoadOnStartup(1);
          servlet.addMapping("/api/*");
  
          ServletRegistration.Dynamic swagger = container.addServlet("SwaggerServlet",
                  new io.swagger.jersey.config.JerseyJaxrsConfig());
          swagger.setInitParameter("api.version", "1.0.0");
          swagger.setInitParameter("swagger.api.basepath", container.getContextPath()+"/api");
          swagger.setLoadOnStartup(2);
      }
  
  }
  </code></pre>
  
  <p>Here is my main model:</p>
  
  <pre><code>import java.io.Serializable;
  
  import javax.validation.constraints.NotNull;
  
  import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  import com.fasterxml.jackson.annotation.JsonInclude;
  
  import io.swagger.annotations.ApiModel;
  
  
  /**
   * @author Tamar Rosen
   *
   */
  
  
  @JsonIgnoreProperties(ignoreUnknown = true)
  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  @ApiModel
  public class Property implements Serializable{
  
      /**
       * 
       */
      private static final long serialVersionUID = 1L;    
  
      private String id;
  
      @NotNull
      private String name;
  
      @NotNull
      private String description;
  
      private PropertyDetails propertyDetails;
  
      private int monthlyTax;
  
      private String schemaUrl;
  
      public String getId() {
          return id;
      }
  
      public void setId(String id) {
          this.id = id;
      }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String getDescription() {
          return description;
      }
  
      public void setDescription(String description) {
          this.description = description;
      }
  
      public PropertyDetails getPropertyDetails() {
          return propertyDetails;
      }
  
      public void setPropertyDetails(PropertyDetails propertyDetails) {
          this.propertyDetails = propertyDetails;
      }
  
      public int getMonthlyTax() {
          return monthlyTax;
      }
  
      public void setMonthlyTax(int monthlyTax) {
          this.monthlyTax = monthlyTax;
      }
  
      public String getSchemaUrl() {
          return schemaUrl;
      }
  
      public void setSchemaUrl(String schemaUrl) {
          this.schemaUrl = schemaUrl;
      }
  
  }
  </code></pre>
  
  <p>The CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES in set in a ContextResolver class. This works fine except that its not reflected in the doc generated by swagger. </p>
  
  <p>Below is the ContextResolver implementation:</p>
  
  <pre><code>    import javax.ws.rs.ext.ContextResolver;
  import javax.ws.rs.ext.Provider;
  
  import com.fasterxml.jackson.databind.ObjectMapper;
  import com.fasterxml.jackson.databind.PropertyNamingStrategy;
  
  @Provider
  public class ObjectMapperContextResolver implements ContextResolver&lt;ObjectMapper&gt; {
  
      private final ObjectMapper mapper;
  
      public ObjectMapperContextResolver() {
          mapper = new ObjectMapper();
          mapper.setPropertyNamingStrategy(
              PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES
          );
      }
  
      public ObjectMapper getContext(Class&lt;?&gt; type) {
          return mapper;
      }
  }
  </code></pre>
  
  <p>I suspect the problem is that the swagger servlet doesn't see the Context resolver, but I don't know how to fix this problem </p>