#18058 Fix the Java generator to generate valid @RequestMappings where the produce field takes list of string parameters instead of a single comma-separated string (#18092)

* #18058 Fix AbstractJavaCodegen.getAccepts() so it returns a String array instead of a comma-separated string, and fixed api.mustache so the @RequestMapping annotation generated produces for x-accepts as a parameter list instead of a (single) string.

* #18058 Updated test case to accept a string array instead of a comma-separated list.

* #18058 Reverted changes on imported compared to the main branch.

* #18058 getAccepts() is now hybrid, and can return both a single String or a String[].

* #18058 Rolled back the hybrid getAccepts(), so it only returns a String array.

* #18058 Updated mustache files to cope with vendorExtensions.x-accepts being a string array instead of a comma-separated string.

* #18058 Generated new sample files with by running `./bin/generate-samples.sh ./bin/configs/*.yaml`

* #18058 Optimization of getAccepts()

* #18058 Regenerated scripts that got broken after resolving conflicts on GitHub

* #18058 Fixed introduced issue with api.mustache causing a redundant accept with @HttpExchange with the PetApi.java, StoreApi.java, and UserApi.java.
This commit is contained in:
Flemming Nørnberg Larsen
2024-03-21 10:53:18 +01:00
committed by GitHub
parent c7e9bd2f29
commit a4508f6817
160 changed files with 6261 additions and 3105 deletions

View File

@@ -47,7 +47,8 @@ paths:
- pet
x-codegen-request-body-name: body
x-content-type: application/json
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: pet
put:
@@ -84,7 +85,8 @@ paths:
- pet
x-codegen-request-body-name: body
x-content-type: application/json
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: pet
/pet/findByStatus:
@@ -132,7 +134,9 @@ paths:
tags:
- pet
x-spring-paginated: true
x-accepts: "application/json,application/xml"
x-accepts:
- application/json
- application/xml
x-tags:
- tag: pet
/pet/all:
@@ -163,7 +167,9 @@ paths:
tags:
- pet
x-spring-paginated: true
x-accepts: "application/json,application/xml"
x-accepts:
- application/json
- application/xml
x-tags:
- tag: pet
/pet/findByTags:
@@ -208,7 +214,9 @@ paths:
tags:
- pet
x-spring-paginated: true
x-accepts: "application/json,application/xml"
x-accepts:
- application/json
- application/xml
x-tags:
- tag: pet
/pet/{petId}:
@@ -245,7 +253,8 @@ paths:
summary: Deletes a pet
tags:
- pet
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: pet
get:
@@ -282,7 +291,9 @@ paths:
summary: Find pet by ID
tags:
- pet
x-accepts: "application/json,application/xml"
x-accepts:
- application/json
- application/xml
x-tags:
- tag: pet
post:
@@ -314,7 +325,8 @@ paths:
tags:
- pet
x-content-type: application/x-www-form-urlencoded
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: pet
/pet/{petId}/uploadImage:
@@ -350,7 +362,8 @@ paths:
tags:
- pet
x-content-type: multipart/form-data
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: pet
/store/inventory:
@@ -372,7 +385,8 @@ paths:
summary: Returns pet inventories by status
tags:
- store
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: store
/store/order:
@@ -403,7 +417,9 @@ paths:
- store
x-codegen-request-body-name: body
x-content-type: '*/*'
x-accepts: "application/json,application/xml"
x-accepts:
- application/json
- application/xml
x-tags:
- tag: store
/store/order/{order_id}:
@@ -430,7 +446,8 @@ paths:
summary: Delete purchase order by ID
tags:
- store
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: store
get:
@@ -468,7 +485,9 @@ paths:
summary: Find purchase order by ID
tags:
- store
x-accepts: "application/json,application/xml"
x-accepts:
- application/json
- application/xml
x-tags:
- tag: store
/user:
@@ -491,7 +510,8 @@ paths:
- user
x-codegen-request-body-name: body
x-content-type: '*/*'
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: user
/user/createWithArray:
@@ -515,7 +535,8 @@ paths:
- user
x-codegen-request-body-name: body
x-content-type: '*/*'
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: user
/user/createWithList:
@@ -539,7 +560,8 @@ paths:
- user
x-codegen-request-body-name: body
x-content-type: '*/*'
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: user
/user/login:
@@ -593,7 +615,9 @@ paths:
summary: Logs user into the system
tags:
- user
x-accepts: "application/json,application/xml"
x-accepts:
- application/json
- application/xml
x-tags:
- tag: user
/user/logout:
@@ -606,7 +630,8 @@ paths:
summary: Logs out current logged in user session
tags:
- user
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: user
/user/{username}:
@@ -632,7 +657,8 @@ paths:
summary: Delete user
tags:
- user
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: user
get:
@@ -665,7 +691,9 @@ paths:
summary: Get user by user name
tags:
- user
x-accepts: "application/json,application/xml"
x-accepts:
- application/json
- application/xml
x-tags:
- tag: user
put:
@@ -699,7 +727,8 @@ paths:
- user
x-codegen-request-body-name: body
x-content-type: '*/*'
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: user
/fake_classname_test:
@@ -727,7 +756,8 @@ paths:
- fake_classname_tags 123#$%^
x-codegen-request-body-name: body
x-content-type: application/json
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: fake_classname_tags 123#$%^
/fake:
@@ -793,7 +823,8 @@ paths:
tags:
- fake
x-group-parameters: true
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: fake
get:
@@ -894,7 +925,8 @@ paths:
tags:
- fake
x-content-type: application/x-www-form-urlencoded
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: fake
patch:
@@ -919,7 +951,8 @@ paths:
- fake
x-codegen-request-body-name: body
x-content-type: application/json
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: fake
post:
@@ -952,7 +985,8 @@ paths:
tags:
- fake
x-content-type: application/x-www-form-urlencoded
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: fake
/fake/outer/number:
@@ -977,7 +1011,8 @@ paths:
- fake
x-codegen-request-body-name: body
x-content-type: '*/*'
x-accepts: '*/*'
x-accepts:
- '*/*'
x-tags:
- tag: fake
/fake/outer/string:
@@ -1002,7 +1037,8 @@ paths:
- fake
x-codegen-request-body-name: body
x-content-type: '*/*'
x-accepts: '*/*'
x-accepts:
- '*/*'
x-tags:
- tag: fake
/fake/outer/boolean:
@@ -1027,7 +1063,8 @@ paths:
- fake
x-codegen-request-body-name: body
x-content-type: '*/*'
x-accepts: '*/*'
x-accepts:
- '*/*'
x-tags:
- tag: fake
/fake/outer/composite:
@@ -1052,7 +1089,8 @@ paths:
- fake
x-codegen-request-body-name: body
x-content-type: '*/*'
x-accepts: '*/*'
x-accepts:
- '*/*'
x-tags:
- tag: fake
/fake/jsonFormData:
@@ -1072,7 +1110,8 @@ paths:
tags:
- fake
x-content-type: application/x-www-form-urlencoded
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: fake
/fake/inline-additionalProperties:
@@ -1096,7 +1135,8 @@ paths:
- fake
x-codegen-request-body-name: param
x-content-type: application/json
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: fake
/fake/body-with-query-params:
@@ -1124,7 +1164,8 @@ paths:
- fake
x-codegen-request-body-name: body
x-content-type: application/json
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: fake
/fake/create_xml_item:
@@ -1162,7 +1203,8 @@ paths:
- fake
x-codegen-request-body-name: XmlItem
x-content-type: application/xml
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: fake
/another-fake/dummy:
@@ -1188,7 +1230,8 @@ paths:
- $another-fake?
x-codegen-request-body-name: body
x-content-type: application/json
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: $another-fake?
/fake/body-with-file-schema:
@@ -1210,7 +1253,8 @@ paths:
- fake
x-codegen-request-body-name: body
x-content-type: application/json
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: fake
/fake/test-query-parameters:
@@ -1269,7 +1313,8 @@ paths:
description: Success
tags:
- fake
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: fake
/fake/{petId}/uploadImageWithRequiredFile:
@@ -1306,7 +1351,8 @@ paths:
tags:
- pet
x-content-type: multipart/form-data
x-accepts: application/json
x-accepts:
- application/json
x-tags:
- tag: pet
/versioning/headers:
@@ -1350,7 +1396,8 @@ paths:
description: successful operation
tags:
- versioning
x-accepts: '*/*'
x-accepts:
- '*/*'
x-tags:
- tag: versioning
/versioning/query-params:
@@ -1394,7 +1441,8 @@ paths:
description: successful operation
tags:
- versioning
x-accepts: '*/*'
x-accepts:
- '*/*'
x-tags:
- tag: versioning
/versioning/mix:
@@ -1457,7 +1505,8 @@ paths:
description: successful operation
tags:
- versioning
x-accepts: '*/*'
x-accepts:
- '*/*'
x-tags:
- tag: versioning
components: