-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix jsontypeinfo schema example generation
- Loading branch information
1 parent
b61078d
commit eae01be
Showing
9 changed files
with
232 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,4 +73,6 @@ ext { | |
swaggerVersion = '2.2.22' | ||
|
||
testcontainersVersion = '1.20.0' | ||
|
||
springdoc = '2.6.0' | ||
} |
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
13 changes: 13 additions & 0 deletions
13
...-example/src/main/java/io/github/springwolf/examples/jms/dtos/JsonTypeInfoExampleOne.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,13 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package io.github.springwolf.examples.jms.dtos; | ||
|
||
import com.fasterxml.jackson.annotation.JsonTypeName; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; | ||
|
||
@JsonTypeName("exampleOne") | ||
@Schema(description = "Json Type Info Example One model") | ||
public record JsonTypeInfoExampleOne( | ||
@Schema(description = "Foo field", example = "fooValue", requiredMode = NOT_REQUIRED) String foo) | ||
implements JsonTypeInfoInterface {} |
13 changes: 13 additions & 0 deletions
13
...-example/src/main/java/io/github/springwolf/examples/jms/dtos/JsonTypeInfoExampleTwo.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,13 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package io.github.springwolf.examples.jms.dtos; | ||
|
||
import com.fasterxml.jackson.annotation.JsonTypeName; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; | ||
|
||
@JsonTypeName("exampleTwo") | ||
@Schema(description = "Json Type Info Example Two model") | ||
public record JsonTypeInfoExampleTwo( | ||
@Schema(description = "Boo field", example = "booValue", requiredMode = NOT_REQUIRED) String boo) | ||
implements JsonTypeInfoInterface {} |
14 changes: 14 additions & 0 deletions
14
...s-example/src/main/java/io/github/springwolf/examples/jms/dtos/JsonTypeInfoInterface.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,14 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package io.github.springwolf.examples.jms.dtos; | ||
|
||
import com.fasterxml.jackson.annotation.JsonSubTypes; | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION, property = "type") | ||
@JsonSubTypes({ | ||
@JsonSubTypes.Type(value = JsonTypeInfoExampleOne.class, name = "exampleOne"), | ||
@JsonSubTypes.Type(value = JsonTypeInfoExampleTwo.class, name = "exampleTwo") | ||
}) | ||
@Schema(oneOf = {JsonTypeInfoExampleOne.class, JsonTypeInfoExampleTwo.class}) | ||
public interface JsonTypeInfoInterface {} |
9 changes: 9 additions & 0 deletions
9
...-example/src/main/java/io/github/springwolf/examples/jms/dtos/JsonTypeInfoPayloadDto.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,9 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package io.github.springwolf.examples.jms.dtos; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@Schema(description = "Json Type Info Payload Dto model") | ||
public record JsonTypeInfoPayloadDto( | ||
@Schema(description = "", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | ||
JsonTypeInfoInterface jsonTypeInfoInterface) {} |
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