-
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.
- Loading branch information
Showing
4 changed files
with
47 additions
and
1 deletion.
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
32 changes: 32 additions & 0 deletions
32
modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/Ticket2862SubtypeTest.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,32 @@ | ||
package io.swagger.v3.core.resolving; | ||
|
||
import io.swagger.v3.core.converter.AnnotatedType; | ||
import io.swagger.v3.core.converter.ModelConverterContextImpl; | ||
import io.swagger.v3.core.jackson.ModelResolver; | ||
import io.swagger.v3.core.matchers.SerializationMatchers; | ||
import io.swagger.v3.core.resolving.resources.Ticket2862Model; | ||
import io.swagger.v3.oas.models.media.Schema; | ||
import org.testng.annotations.Test; | ||
|
||
public class Ticket2862SubtypeTest extends SwaggerTestBase { | ||
@Test | ||
public void testSubType() throws Exception { | ||
final ModelResolver modelResolver = new ModelResolver(mapper()); | ||
|
||
final ModelConverterContextImpl context = new ModelConverterContextImpl(modelResolver); | ||
|
||
final Schema model = context | ||
.resolve(new AnnotatedType(Ticket2862Model.class)); | ||
|
||
SerializationMatchers.assertEqualsToYaml(context.getDefinedModels(), "Ticket2862Model:\n" + | ||
" type: object\n" + | ||
"Ticket2862ModelImpl:\n" + | ||
" type: string\n" + | ||
" allOf:\n" + | ||
" - $ref: '#/components/schemas/Ticket2862Model'\n" + | ||
" enum:\n" + | ||
" - VALUE1\n" + | ||
" - VALUE2"); | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
...es/swagger-core/src/test/java/io/swagger/v3/core/resolving/resources/Ticket2862Model.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,6 @@ | ||
package io.swagger.v3.core.resolving.resources; | ||
|
||
@com.fasterxml.jackson.annotation.JsonTypeInfo(use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, include = com.fasterxml.jackson.annotation.JsonTypeInfo.As.WRAPPER_OBJECT) | ||
@com.fasterxml.jackson.annotation.JsonSubTypes({ | ||
@com.fasterxml.jackson.annotation.JsonSubTypes.Type(value = Ticket2862ModelImpl.class)}) | ||
public interface Ticket2862Model {} |
6 changes: 6 additions & 0 deletions
6
...wagger-core/src/test/java/io/swagger/v3/core/resolving/resources/Ticket2862ModelImpl.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,6 @@ | ||
package io.swagger.v3.core.resolving.resources; | ||
|
||
public enum Ticket2862ModelImpl implements Ticket2862Model { | ||
VALUE1, | ||
VALUE2 | ||
} |