Skip to content

Commit 258ed4b

Browse files
committed
Implement a test for #1961
1 parent c690d8d commit 258ed4b

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package io.swagger.v3.parser.test;
2+
3+
import io.swagger.v3.parser.OpenAPIV3Parser;
4+
import io.swagger.v3.parser.core.models.ParseOptions;
5+
import io.swagger.v3.parser.core.models.SwaggerParseResult;
6+
import org.testng.annotations.Test;
7+
8+
import static org.testng.Assert.assertFalse;
9+
10+
public class ResolverCacheCircularTest {
11+
@Test
12+
public void testIssue1961_DuplicateSchemas_ABA() throws Exception {
13+
ParseOptions parseOptions = new ParseOptions();
14+
parseOptions.setResolve(true);
15+
SwaggerParseResult result = new OpenAPIV3Parser().readLocation("src/test/resources/issue-1961/Foo.yaml", null, parseOptions);
16+
assertFalse(result.getOpenAPI().getComponents().getSchemas().containsKey("FooBar_1"));
17+
}
18+
}
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)