-
Notifications
You must be signed in to change notification settings - Fork 531
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
1 parent
c690d8d
commit 4c79270
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
.../swagger-parser-v3/src/test/java/io/swagger/v3/parser/test/ResolverCacheTestCircular.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,16 @@ | ||
import io.swagger.v3.parser.OpenAPIV3Parser; | ||
import io.swagger.v3.parser.core.models.ParseOptions; | ||
import io.swagger.v3.parser.core.models.SwaggerParseResult; | ||
import org.testng.annotations.Test; | ||
|
||
import static org.testng.Assert.assertFalse; | ||
|
||
public class ResolverCacheTestCircular { | ||
@Test | ||
public void testIssue1961_DuplicateSchemas_ABA() { | ||
ParseOptions parseOptions = new ParseOptions(); | ||
parseOptions.setResolve(true); | ||
SwaggerParseResult result = new OpenAPIV3Parser().readLocation("src/test/resources/issue-1961/Foo.yaml", null, parseOptions); | ||
assertFalse(result.getOpenAPI().getComponents().getSchemas().containsKey("TestCase_1")); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
modules/swagger-parser-v3/src/test/resources/issue-1961/Bar.yaml
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 @@ | ||
components: | ||
schemas: | ||
Bar: | ||
anyOf: | ||
- $ref: ./Foo.yaml#/components/schemas/FooBar | ||
BarType: | ||
enum: | ||
- All | ||
- OEM | ||
type: string | ||
info: | ||
title: '#Issue1961.Bar' | ||
openapi: 3.0.1 |
17 changes: 17 additions & 0 deletions
17
modules/swagger-parser-v3/src/test/resources/issue-1961/Foo.yaml
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,17 @@ | ||
components: | ||
schemas: | ||
FooBar: | ||
properties: | ||
BypassTypes: | ||
items: | ||
$ref: ./Bar.yaml#/components/schemas/BarType | ||
type: array | ||
type: object | ||
Foo: | ||
properties: | ||
MFABypass: | ||
$ref: ./Bar.yaml#/components/schemas/Bar | ||
type: object | ||
info: | ||
title: '#Issue1961.Foo' | ||
openapi: 3.0.1 |