Skip to content

Commit 65cb95b

Browse files
adrianhjAdrian Hjertstedt
andauthored
Revert "[typescript-fetch] to fix incorrect parsing with additional properties (#20923)" (#21542)
This reverts commit 0becb3f. Co-authored-by: Adrian Hjertstedt <ahjertstedt@ldms.com>
1 parent 78691cb commit 65cb95b

File tree

4 files changed

+16
-103
lines changed

4 files changed

+16
-103
lines changed

modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ export class {{classname}} extends runtime.BaseAPI {
266266
{{/isEnumRef}}
267267
{{^isEnumRef}}
268268
{{^withoutRuntimeChecks}}
269-
formParams.append('{{baseName}}', new Blob([JSON.stringify({{returnType}}ToJSON(requestParameters['{{paramName}}']))], { type: "application/json", }));
269+
formParams.append('{{baseName}}', new Blob([JSON.stringify({{{dataType}}}ToJSON(requestParameters['{{paramName}}']))], { type: "application/json", }));
270270
{{/withoutRuntimeChecks}}{{#withoutRuntimeChecks}}
271271
formParams.append('{{baseName}}', new Blob([JSON.stringify(requestParameters['{{paramName}}'])], { type: "application/json", }));
272272
{{/withoutRuntimeChecks}}

modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -347,31 +347,6 @@ public void testGeneratedFilenamesInCamelCaseWithAdditionalModelPrefix() throws
347347
TestUtils.assertFileExists(Paths.get(output + "/apis/petControllerApi.ts"));
348348
}
349349

350-
@Test(description = "Issue #20195")
351-
public void givenObjectHasAdditionalPropertiesWhenGenerateThenIndexSignatureNotUsedToGenerateMethodName() throws IOException {
352-
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
353-
output.deleteOnExit();
354-
355-
TypeScriptFetchClientCodegen clientCodegen = new TypeScriptFetchClientCodegen();
356-
clientCodegen.setWithoutRuntimeChecks(false);
357-
clientCodegen.setOutputDir(output.getAbsolutePath());
358-
359-
Map<String, Object> properties = new HashMap<>();
360-
properties.put(TypeScriptFetchClientCodegen.WITH_INTERFACES, true);
361-
properties.put(CodegenConstants.ENUM_PROPERTY_NAMING, "original");
362-
clientCodegen.additionalProperties().putAll(properties);
363-
364-
DefaultGenerator defaultGenerator = new DefaultGenerator();
365-
defaultGenerator.opts(
366-
new ClientOptInput().openAPI(TestUtils.parseSpec("src/test/resources/bugs/issue_20195.json"))
367-
.config(clientCodegen)
368-
).generate();
369-
370-
String outputPath = output.getAbsolutePath();
371-
Path exampleApiPath = Paths.get(outputPath + "/apis/ExampleApi.ts");
372-
TestUtils.assertFileContains(exampleApiPath, "new Blob([JSON.stringify(ResponseOfStringToJSON");
373-
}
374-
375350
private static File generate(Map<String, Object> properties) throws IOException {
376351
File output = Files.createTempDirectory("test").toFile();
377352
output.deleteOnExit();

modules/openapi-generator/src/test/resources/bugs/issue_20195.json

Lines changed: 0 additions & 77 deletions
This file was deleted.

samples/client/petstore/typescript-fetch/tests/default/package-lock.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)