Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export class {{classname}} extends runtime.BaseAPI {
{{/isEnumRef}}
{{^isEnumRef}}
{{^withoutRuntimeChecks}}
formParams.append('{{baseName}}', new Blob([JSON.stringify({{returnType}}ToJSON(requestParameters['{{paramName}}']))], { type: "application/json", }));
formParams.append('{{baseName}}', new Blob([JSON.stringify({{{dataType}}}ToJSON(requestParameters['{{paramName}}']))], { type: "application/json", }));
{{/withoutRuntimeChecks}}{{#withoutRuntimeChecks}}
formParams.append('{{baseName}}', new Blob([JSON.stringify(requestParameters['{{paramName}}'])], { type: "application/json", }));
{{/withoutRuntimeChecks}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,31 +347,6 @@ public void testGeneratedFilenamesInCamelCaseWithAdditionalModelPrefix() throws
TestUtils.assertFileExists(Paths.get(output + "/apis/petControllerApi.ts"));
}

@Test(description = "Issue #20195")
public void givenObjectHasAdditionalPropertiesWhenGenerateThenIndexSignatureNotUsedToGenerateMethodName() throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();

TypeScriptFetchClientCodegen clientCodegen = new TypeScriptFetchClientCodegen();
clientCodegen.setWithoutRuntimeChecks(false);
clientCodegen.setOutputDir(output.getAbsolutePath());

Map<String, Object> properties = new HashMap<>();
properties.put(TypeScriptFetchClientCodegen.WITH_INTERFACES, true);
properties.put(CodegenConstants.ENUM_PROPERTY_NAMING, "original");
clientCodegen.additionalProperties().putAll(properties);

DefaultGenerator defaultGenerator = new DefaultGenerator();
defaultGenerator.opts(
new ClientOptInput().openAPI(TestUtils.parseSpec("src/test/resources/bugs/issue_20195.json"))
.config(clientCodegen)
).generate();

String outputPath = output.getAbsolutePath();
Path exampleApiPath = Paths.get(outputPath + "/apis/ExampleApi.ts");
TestUtils.assertFileContains(exampleApiPath, "new Blob([JSON.stringify(ResponseOfStringToJSON");
}

private static File generate(Map<String, Object> properties) throws IOException {
File output = Files.createTempDirectory("test").toFile();
output.deleteOnExit();
Expand Down
77 changes: 0 additions & 77 deletions modules/openapi-generator/src/test/resources/bugs/issue_20195.json

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading