-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs #3080 - support array in additionalProperties annotation member
- Loading branch information
Showing
4 changed files
with
196 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
...xrs2/src/test/java/io/swagger/v3/jaxrs2/resources/SchemaAdditionalPropertiesResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package io.swagger.v3.jaxrs2.resources; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.ArraySchema; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.core.Response; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class SchemaAdditionalPropertiesResource { | ||
|
||
static class Pet { | ||
public String foo; | ||
} | ||
@GET | ||
@Path("/fromtResponseType") | ||
public Map<String, List<Pet>> fromtResponseType() { | ||
return null; | ||
} | ||
|
||
@GET | ||
@Path("/schemaNotImpl") | ||
@Operation( | ||
operationId = "schemaNotImpl", | ||
responses = { | ||
@ApiResponse( | ||
responseCode = "200", | ||
description = "voila!", | ||
content = @Content( | ||
mediaType = "application/json", | ||
schema = @Schema( | ||
type = "object" | ||
), | ||
additionalPropertiesSchema = @Schema( | ||
ref = "#/components/schemas/Pet" | ||
) | ||
) | ||
) | ||
} | ||
) | ||
public Response schemaNotImpl() { | ||
return null; | ||
} | ||
|
||
@GET | ||
@Path("/schemaImpl") | ||
@Operation( | ||
operationId = "schemaImpl", | ||
responses = { | ||
@ApiResponse( | ||
responseCode = "200", | ||
description = "voila!", | ||
content = @Content( | ||
mediaType = "application/json", | ||
schema = @Schema( | ||
type = "object", | ||
additionalPropertiesSchema = Pet.class | ||
) | ||
) | ||
) | ||
} | ||
) | ||
public Response schemaImpl() { | ||
return null; | ||
} | ||
|
||
@GET | ||
@Path("/arraySchemaImpl") | ||
@Operation( | ||
operationId = "arraySchemaImpl", | ||
responses = { | ||
@ApiResponse( | ||
responseCode = "200", | ||
description = "voila!", | ||
content = @Content( | ||
mediaType = "application/json", | ||
additionalPropertiesArraySchema = @ArraySchema( | ||
schema = @Schema( | ||
implementation = Pet.class | ||
) | ||
), | ||
schema = @Schema( | ||
type = "object" | ||
) | ||
) | ||
) | ||
} | ||
) | ||
public Response arraySchemaImpl() { | ||
return null; | ||
} | ||
|
||
} |