forked from loafle/openapi-generator-original
add a test for generateParameterId (#20256)
This commit is contained in:
parent
b2507777e6
commit
6ba311e85c
@ -3210,4 +3210,28 @@ public class JavaClientCodegenTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
@Test
|
||||||
|
public void testGenerateParameterId() {
|
||||||
|
final Path output = newTempFolder();
|
||||||
|
final CodegenConfigurator configurator = new CodegenConfigurator()
|
||||||
|
.setValidateSpec(false)
|
||||||
|
.setGeneratorName("java")
|
||||||
|
.setAdditionalProperties(Map.of(
|
||||||
|
CodegenConstants.API_PACKAGE, "xyz.abcdef.api"
|
||||||
|
))
|
||||||
|
.setInputSpec("src/test/resources/3_1/issue_20239.yaml")
|
||||||
|
.setOutputDir(output.toString().replace("\\", "/"));
|
||||||
|
|
||||||
|
new DefaultGenerator().opts(configurator.toClientOptInput()).generate();
|
||||||
|
|
||||||
|
TestUtils.assertFileContains(
|
||||||
|
output.resolve("src/main/java/xyz/abcdef/api/ATagApi.java"),
|
||||||
|
" getCall(String pathParameter, Integer queryParameter, final ApiCallback _callback)"
|
||||||
|
);
|
||||||
|
|
||||||
|
TestUtils.assertFileNotContains(
|
||||||
|
output.resolve("src/main/java/xyz/abcdef/api/ATagApi.java"),
|
||||||
|
" getCall(Integer queryParameter, final ApiCallback _callback)"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
openapi: 3.1.0
|
||||||
|
info:
|
||||||
|
title: API Overview
|
||||||
|
version: "v1"
|
||||||
|
description: description
|
||||||
|
|
||||||
|
tags:
|
||||||
|
- name: aTag
|
||||||
|
|
||||||
|
paths:
|
||||||
|
"/path/{path_parameter}":
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/path_parameter"
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- aTag
|
||||||
|
operationId: get
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/query_parameter"
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: no body
|
||||||
|
components:
|
||||||
|
parameters:
|
||||||
|
path_parameter:
|
||||||
|
name: path_parameter
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
|
||||||
|
query_parameter:
|
||||||
|
name: query_parameter
|
||||||
|
in: query
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
minimum: 0
|
||||||
|
default: 0
|
Loading…
x
Reference in New Issue
Block a user