Skip to content

[Java][feign] snake_case parameter names break feign client #5296

@ePaul

Description

@ePaul
Description

Updating the samples for java/feign in current master and then running the tests of the generated client leads to test failures:

Tests in error: 
  testDeleteOrder(io.swagger.client.api.StoreApiTest): status 400 reading StoreApi#getOrderById(Long); content:(..)
  testPlaceOrder(io.swagger.client.api.StoreApiTest): status 400 reading StoreApi#getOrderById(Long); content:(..)
Swagger-codegen version

Yesterday's master (64c7e23), not sure if this applies to any released version.

Swagger declaration file content or url

petstore-with-fake-endpoints-models-for-testing.yaml

Command line used for generation
bin/java-petstore-feign.sh
Steps to reproduce
bin/java-petstore-feign.sh
mvn verify -P samples -pl :swagger-petstore-feign
Related issues

I think this might be another instance of #4898, which was uncovered by the parameter name change in #5267. (I noticed this by the failing tests in #5281.)

Suggest a Fix

This is now generated:

  /**
   * Delete purchase order by ID
   * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
    * @param orderId ID of the order that needs to be deleted (required)
   */
  @RequestLine("DELETE /store/order/{order_id}")
  @Headers({
    "Content-Type: application/json",
    "Accept: application/json",
  })
  void deleteOrder(@Param("orderId") String orderId);

The @RequestLine changed from previously {orderId} to now {order_id}, while the @Param didn't change, and now doesn't match anymore.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions