-
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.
add unittest for v3.1 which has both ref and description
- Loading branch information
1 parent
9279ae3
commit c35dce7
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/Ticket3900Test.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,49 @@ | ||
package io.swagger.v3.core.resolving.v31; | ||
|
||
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.SwaggerTestBase; | ||
import org.testng.annotations.Test; | ||
|
||
public class Ticket3900Test extends SwaggerTestBase { | ||
|
||
@Test | ||
public void testArraySchemaItemsValidation() { | ||
final ModelResolver modelResolver = new ModelResolver(mapper()).openapi31(true); | ||
final ModelConverterContextImpl context = new ModelConverterContextImpl(modelResolver); | ||
io.swagger.v3.oas.models.media.Schema model = context.resolve(new AnnotatedType(Route.class)); | ||
SerializationMatchers.assertEqualsToYaml31(model, "type: object\n" + | ||
"properties:\n" + | ||
" startPoint:\n" + | ||
" $ref: '#/components/schemas/GeoPoint'\n" + | ||
" description: Point where the route begins\n" + | ||
" intermediatePoint:\n" + | ||
" $ref: '#/components/schemas/GeoPoint'\n" + | ||
" description: Intermediate point of the route\n" + | ||
" endPoint:\n" + | ||
" $ref: '#/components/schemas/GeoPoint'\n" + | ||
" description: Point where the route ends"); | ||
} | ||
|
||
private static class GeoPoint { | ||
|
||
@io.swagger.v3.oas.annotations.media.Schema(description = "Longitude of geo point ( -180, 180 >") | ||
public double lon; | ||
|
||
@io.swagger.v3.oas.annotations.media.Schema(description = "Latitude of geo point < -90, 90 >") | ||
public double lat; | ||
} | ||
|
||
private static class Route { | ||
@io.swagger.v3.oas.annotations.media.Schema(description = "Point where the route begins") | ||
public GeoPoint startPoint; | ||
|
||
@io.swagger.v3.oas.annotations.media.Schema(description = "Intermediate point of the route") | ||
public GeoPoint intermediatePoint; | ||
|
||
@io.swagger.v3.oas.annotations.media.Schema(description = "Point where the route ends") | ||
public GeoPoint endPoint; | ||
} | ||
} |