mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 12:40:53 +00:00
Merge 9bac629a5a06e1b5e9308e3ea3cf556914dba484 into d6c46342693205f0dae441b45742d9c85d41cf33
This commit is contained in:
commit
0512253eed
@ -674,6 +674,28 @@ public class SpringCodegenTest {
|
||||
// Assert.assertEquals(codegen.additionalProperties().get(SpringCodegen.USE_RESPONSE_ENTITY), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
// Currently not working due to https://github.com/OpenAPITools/openapi-generator/pull/11449
|
||||
// Reverting the change would reintroduce the issue that was fixed there
|
||||
// https://github.com/OpenAPITools/openapi-generator/issues/12498
|
||||
public void testMultipartWithFileAndObject_12498_Regression() throws IOException {
|
||||
final SpringCodegen codegen = new SpringCodegen();
|
||||
codegen.setLibrary("spring-boot");
|
||||
codegen.setInterfaceOnly(true);
|
||||
|
||||
final Map<String, File> files = generateFiles(codegen, "src/test/resources/3_0/issue_12498.yaml");
|
||||
JavaFileAssert.assertThat(files.get("TestApi.java"))
|
||||
.assertMethod("testPost", "MultipartFile", "TestObjectPart")
|
||||
.hasParameter("file").withType("MultipartFile")
|
||||
.assertParameterAnnotations()
|
||||
.containsWithNameAndAttributes("RequestPart", ImmutableMap.of("value", "\"file\"", "required", "true"))
|
||||
.toParameter().toMethod()
|
||||
.hasParameter("content").withType("TestObjectPart")
|
||||
.assertParameterAnnotations()
|
||||
.containsWithNameAndAttributes("RequestPart", ImmutableMap.of("value", "\"content\"", "required", "true"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipartBoot() throws IOException {
|
||||
final SpringCodegen codegen = new SpringCodegen();
|
||||
|
@ -0,0 +1,42 @@
|
||||
openapi: 3.0.2
|
||||
info:
|
||||
version: 1.0.0
|
||||
title: test
|
||||
|
||||
paths:
|
||||
/test:
|
||||
post:
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
encoding:
|
||||
file:
|
||||
contentType: "application/octet-stream"
|
||||
content:
|
||||
contentType: "application/json"
|
||||
schema:
|
||||
type: object
|
||||
required:
|
||||
- file
|
||||
- content
|
||||
properties:
|
||||
file:
|
||||
type: string
|
||||
format: binary
|
||||
content:
|
||||
$ref: "#/components/schemas/testObjectPart"
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
|
||||
components:
|
||||
schemas:
|
||||
testObjectPart:
|
||||
type: object
|
||||
required:
|
||||
- foo
|
||||
properties:
|
||||
foo:
|
||||
type: string
|
||||
bar:
|
||||
type: number
|
Loading…
x
Reference in New Issue
Block a user