Description
Using the feign java client the parameter names used in the request are named according Java rules not as defined in the api description.
openapi-generator version
4.0.2
OpenAPI declaration file content or url
openapi: 3.0.0
info:
description: TEST API
version: "1.0"
title: test
servers:
- url: /
paths:
/test/j_security_check:
post:
tags:
- test
summary: performs login
operationId: performLogin
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
$ref: "#/components/schemas/LoginForm"
responses:
200:
description: successful login
content:
application/json:
schema:
$ref: "#/components/schemas/Success"
components:
schemas:
Success:
type: object
properties:
test:
type: string
LoginForm:
type: object
required:
- j_username
- j_password
properties:
j_username:
type: string
j_password:
type: string
Command line used for generation
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<executions>
<execution>
<id>generate-test-client</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/client/test/v1.yml</inputSpec>
<output>${project.basedir}/generated-client-sources</output>
<generatorName>java</generatorName>
<apiPackage>de.mhb.test.client.v1</apiPackage>
<modelPackage>de.mhb.testclient.v1</modelPackage>
<invokerPackage>de.mhb.testclient.v1</invokerPackage>
<configOptions>
<sourceFolder>openapi</sourceFolder>
<java8>false</java8><!-- avoid build interface default implementations -->
<dateLibrary>java8</dateLibrary><!-- use OffsetDateTime -->
<ensureUniqueParams>false</ensureUniqueParams>
</configOptions>
<library>feign</library>
<addCompileSourceRoot>true</addCompileSourceRoot>
</configuration>
</execution>
</executions>
</plugin>
- build client using maven and given yml file
- call method performLogin
Request parameters are "jUsername" and "jPassword" instead of "j_username" and "j_password".
Suggest a fix
In https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/Java/libraries/feign/api.mustache replace all occurencies of
by
Description
Using the feign java client the parameter names used in the request are named according Java rules not as defined in the api description.
openapi-generator version
4.0.2
OpenAPI declaration file content or url
Command line used for generation
Request parameters are "jUsername" and "jPassword" instead of "j_username" and "j_password".
Suggest a fix
In https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/Java/libraries/feign/api.mustache replace all occurencies of
by