Skip to content

Commit 4c79270

Browse files
committed
Implement a test for #1961
1 parent c690d8d commit 4c79270

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import io.swagger.v3.parser.OpenAPIV3Parser;
2+
import io.swagger.v3.parser.core.models.ParseOptions;
3+
import io.swagger.v3.parser.core.models.SwaggerParseResult;
4+
import org.testng.annotations.Test;
5+
6+
import static org.testng.Assert.assertFalse;
7+
8+
public class ResolverCacheTestCircular {
9+
@Test
10+
public void testIssue1961_DuplicateSchemas_ABA() {
11+
ParseOptions parseOptions = new ParseOptions();
12+
parseOptions.setResolve(true);
13+
SwaggerParseResult result = new OpenAPIV3Parser().readLocation("src/test/resources/issue-1961/Foo.yaml", null, parseOptions);
14+
assertFalse(result.getOpenAPI().getComponents().getSchemas().containsKey("TestCase_1"));
15+
}
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
components:
2+
schemas:
3+
Bar:
4+
anyOf:
5+
- $ref: ./Foo.yaml#/components/schemas/FooBar
6+
BarType:
7+
enum:
8+
- All
9+
- OEM
10+
type: string
11+
info:
12+
title: '#Issue1961.Bar'
13+
openapi: 3.0.1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
components:
2+
schemas:
3+
FooBar:
4+
properties:
5+
BypassTypes:
6+
items:
7+
$ref: ./Bar.yaml#/components/schemas/BarType
8+
type: array
9+
type: object
10+
Foo:
11+
properties:
12+
MFABypass:
13+
$ref: ./Bar.yaml#/components/schemas/Bar
14+
type: object
15+
info:
16+
title: '#Issue1961.Foo'
17+
openapi: 3.0.1

0 commit comments

Comments
 (0)