-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Description
Description:
Currently, when using free form query parameters, the URI is not built correctly.
Steps to reproduce:
Input spec file:
openapi: 3.0.0
info:
title: test
version: 0.0.1
servers:
- url: "http://localhost"
paths:
/some/endpoint:
get:
parameters:
- in: "query"
name: "fixed"
schema:
type: "string"
- in: "query"
name: "free-form"
schema:
type: "object"
style: "form"
responses:
200:
description: "test"
Command to generate client files:
java -jar modules\openapi-generator-cli\target\openapi-generator-cli.jar generate -i spec.yml -o work -g java --library resttemplate
Client code ( usage of generated API ):
ApiClient apiClient = new ApiClient();
DefaultApi defaultApi = new DefaultApi(apiClient);
Map<String, Object> freeFormQueryParams = new HashMap<>();
freeFormQueryParams.put("this", "first");
freeFormQueryParams.put("that", "second");
freeFormQueryParams.put("other", "third");
defaultApi.someEndpointGet("fixedValue", freeFormQueryParams);
Expected result of URI built for the endpoint:
http://localhost/some/endpoint?fixed=fixedValue&this=first&that=second&other=third
Actual result:
http://localhost/some/endpoint?fixed=fixedValue&free-form=%7Bthat%3Dsecond%2C+other%3Dthird%2C+this%3Dfirst%7D
Tested with master as of today.
I've added a patch that addresses this, I'll open a PR soon, too.
Reactions are currently unavailable