Skip to content

Commit 32dd655

Browse files
committed
add targeted sample spec to demonstrate duplicated equivalent refs
1 parent 0ab2e8a commit 32dd655

File tree

215 files changed

+5026
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+5026
-1
lines changed

modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/test/OpenAPIV3ParserTest.java

+16-1
Original file line numberDiff line numberDiff line change
@@ -1953,6 +1953,21 @@ public void testRelativePath2() {
19531953
Assert.assertEquals(readResult.getOpenAPI().getPaths().get("/pet/findByTags").getGet().getResponses().get("default").getContent().get("application/json").getSchema().get$ref(), "#/components/schemas/ErrorModel");
19541954
}
19551955

1956+
@Test
1957+
public void testExternalRefsNormalization() throws Exception {
1958+
ParseOptions options = new ParseOptions();
1959+
options.setResolve(true);
1960+
SwaggerParseResult result = new OpenAPIV3Parser()
1961+
.readLocation("src/test/resources/oas3.fetched/openapi3.yaml", null, options);
1962+
1963+
OpenAPI openAPI = result.getOpenAPI();
1964+
Schema originalModel = openAPI.getComponents().getSchemas().get("Event");
1965+
Schema duplicateModel = openAPI.getComponents().getSchemas().get("Event_1");
1966+
System.out.println("component schemas found: " + openAPI.getComponents().getSchemas().keySet());
1967+
assertNull(duplicateModel);
1968+
assertNotNull(originalModel);
1969+
}
1970+
19561971
private OpenAPI doRelativeFileTest(String location) {
19571972
OpenAPIV3Parser parser = new OpenAPIV3Parser();
19581973
ParseOptions options = new ParseOptions();
@@ -3298,4 +3313,4 @@ public void testIssue2081() {
32983313
assertEquals(openAPI.getComponents().getSchemas().get("PetCreate").getRequired().size(), 1);
32993314
assertEquals(openAPI.getComponents().getSchemas().get("PetCreate").getProperties().size(), 2);
33003315
}
3301-
}
3316+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
properties:
2+
address:
3+
type: string
4+
address2:
5+
type: string
6+
city:
7+
type: string
8+
coordinates:
9+
$ref: './Coordinates.yaml'
10+
country:
11+
type: string
12+
state:
13+
type: string
14+
zip_code:
15+
type: string
16+
required:
17+
- address
18+
- zip_code
19+
- country
20+
type: object
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
properties:
2+
namespace:
3+
readOnly: true
4+
type: string
5+
description: Attribute namespace
6+
created_at:
7+
readOnly: true
8+
type: string
9+
format: date-time
10+
description: Datetime when the block was created.
11+
updated_at:
12+
readOnly: true
13+
type: string
14+
format: date-time
15+
description: Datetime when the block was updated.
16+
data:
17+
$ref: "./AttributeData.yaml"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
properties:
2+
latest:
3+
readOnly: true
4+
type: boolean
5+
description: Boolean flag to know if the firmware set is the latest for the model and vendor
6+
model:
7+
readOnly: true
8+
type: string
9+
description: Model on which this firmware set can be applied
10+
vendor:
11+
readOnly: true
12+
type: string
13+
description: Vendor on which this firmware set can be applied
14+
plan:
15+
readOnly: true
16+
type: string
17+
description: Plan where the firmware set can be applied
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
properties:
2+
created_at:
3+
format: date-time
4+
type: string
5+
description:
6+
description: Available only for API keys
7+
type: string
8+
id:
9+
format: uuid
10+
type: string
11+
project:
12+
allOf:
13+
- $ref: './Project.yaml'
14+
- description: Available only for project tokens
15+
read_only:
16+
type: boolean
17+
token:
18+
type: string
19+
updated_at:
20+
format: date-time
21+
type: string
22+
user:
23+
allOf:
24+
- $ref: './User.yaml'
25+
- description: Available only for user tokens
26+
type: object
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
properties:
2+
description:
3+
type: string
4+
read_only:
5+
type: boolean
6+
type: object
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
properties:
2+
api_keys:
3+
items:
4+
$ref: './AuthToken.yaml'
5+
type: array
6+
type: object
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
properties:
2+
address_family:
3+
description: Address family for BGP session.
4+
enum:
5+
- ipv4
6+
- ipv6
7+
example: ipv4
8+
type: string
9+
default_route:
10+
default: false
11+
description: Set the default route policy.
12+
type: boolean
13+
type: object
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
properties:
2+
created_at:
3+
format: date-time
4+
type: string
5+
devices:
6+
items:
7+
$ref: './Href.yaml'
8+
type: array
9+
error_messages:
10+
items:
11+
type: string
12+
type: array
13+
id:
14+
format: uuid
15+
type: string
16+
project:
17+
$ref: './Href.yaml'
18+
quantity:
19+
type: integer
20+
state:
21+
type: string
22+
updated_at:
23+
format: date-time
24+
type: string
25+
type: object
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
properties:
2+
batches:
3+
items:
4+
$ref: './Batch.yaml'
5+
type: array
6+
type: object
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
properties:
2+
asn:
3+
description: Autonomous System Number. ASN is required with Global BGP. With Local
4+
BGP the private ASN, 65000, is assigned.
5+
example: 65000
6+
format: int32
7+
type: integer
8+
created_at:
9+
format: date-time
10+
type: string
11+
deployment_type:
12+
description: |
13+
In a Local BGP deployment, a customer uses an internal ASN to control routes within a single Equinix Metal datacenter. This means that the routes are never advertised to the global Internet. Global BGP, on the other hand, requires a customer to have a registered ASN and IP space.
14+
enum:
15+
- global
16+
- local
17+
example: local
18+
type: string
19+
href:
20+
type: string
21+
id:
22+
format: uuid
23+
type: string
24+
max_prefix:
25+
default: 10
26+
description: The maximum number of route filters allowed per server
27+
type: integer
28+
md5:
29+
description: (Optional) Password for BGP session in plaintext (not a checksum)
30+
nullable: true
31+
type: string
32+
project:
33+
$ref: './Href.yaml'
34+
ranges:
35+
description: The IP block ranges associated to the ASN (Populated in Global BGP
36+
only)
37+
items:
38+
$ref: './GlobalBgpRange.yaml'
39+
type: array
40+
requested_at:
41+
format: date-time
42+
type: string
43+
route_object:
44+
description: Specifies AS-MACRO (aka AS-SET) to use when building client route
45+
filters
46+
type: string
47+
sessions:
48+
description: The direct connections between neighboring routers that want to exchange
49+
routing information.
50+
items:
51+
$ref: './BgpSession.yaml'
52+
type: array
53+
status:
54+
description: Status of the BGP Config. Status "requested" is valid only with the
55+
"global" deployment_type.
56+
enum:
57+
- requested
58+
- enabled
59+
- disabled
60+
type: string
61+
type: object
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
properties:
2+
asn:
3+
type: integer
4+
minimum: 0
5+
maximum: 4294967295
6+
description: Autonomous System Number for local BGP deployment.
7+
example: 65000
8+
deployment_type:
9+
description: Wether the BGP deployment is local or global. Local deployments are configured immediately. Global deployments will need to be reviewed by Equinix Metal engineers.
10+
type: string
11+
example: local
12+
enum:
13+
- local
14+
- global
15+
md5:
16+
type: string
17+
description: |
18+
The plaintext password to share between BGP neighbors as an MD5 checksum:
19+
* must be 10-20 characters long
20+
* may not include punctuation
21+
* must be a combination of numbers and letters
22+
* must contain at least one lowercase, uppercase, and digit character
23+
pattern: '^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{10,20}$'
24+
use_case:
25+
description: A use case explanation (necessary for global BGP request review).
26+
type: string
27+
required:
28+
- deployment_type
29+
- asn
30+
type: object
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
properties:
2+
id:
3+
description: The unique identifier for the resource
4+
format: uuid
5+
readOnly: true
6+
type: string
7+
example: aea82f16-57ec-412c-9523-b7f2b27635b2
8+
bgp_neighbor_asn:
9+
description: The ASN of the dynamic BGP neighbor
10+
type: integer
11+
example: 12345
12+
bgp_neighbor_range:
13+
description: Network range of the dynamic BGP neighbor in CIDR format
14+
type: string
15+
example: 192.168.1.0/25
16+
metal_gateway:
17+
$ref: './VrfMetalGateway.yaml'
18+
state:
19+
readOnly: true
20+
type: string
21+
enum:
22+
- active
23+
- deleting
24+
- pending
25+
- ready
26+
href:
27+
type: string
28+
readOnly: true
29+
example: /bgp-dynamic-neighbors/aea82f16-57ec-412c-9523-b7f2b27635b2
30+
created_at:
31+
format: date-time
32+
readOnly: true
33+
type: string
34+
created_by:
35+
$ref: './UserLimited.yaml'
36+
updated_at:
37+
format: date-time
38+
readOnly: true
39+
type: string
40+
tags:
41+
items:
42+
type: string
43+
type: array
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
properties:
2+
bgp_neighbor_range:
3+
description: Network range of the dynamic BGP neighbor in CIDR format
4+
type: string
5+
example: 192.168.1.0/25
6+
bgp_neighbor_asn:
7+
description: The ASN of the dynamic BGP neighbor
8+
type: integer
9+
example: 12345
10+
tags:
11+
items:
12+
type: string
13+
type: array
14+
required:
15+
- bgp_neighbor_range
16+
- bgp_neighbor_asn
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
properties:
2+
bgp_dynamic_neighbors:
3+
items:
4+
$ref: './BgpDynamicNeighbor.yaml'
5+
type: array
6+
meta:
7+
$ref: './Meta.yaml'
8+
type: object
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
properties:
2+
address_family:
3+
description: Address Family for IP Address. Accepted values are 4 or 6
4+
example: 4
5+
format: int32
6+
type: integer
7+
customer_as:
8+
description: The customer's ASN. In a local BGP deployment, this will be an internal
9+
ASN used to route within the data center. For a global BGP deployment, this
10+
will be the your own ASN, configured when you set up BGP for your project.
11+
example: 65000
12+
format: int32
13+
type: integer
14+
customer_ip:
15+
description: The device's IP address. For an IPv4 BGP session, this is typically
16+
the private bond0 address for the device.
17+
example: 10.32.16.1 (IPv4) or 2604:1380:4111:2700::1 (IPv6)
18+
type: string
19+
md5_enabled:
20+
description: True if an MD5 password is configured for the project.
21+
type: boolean
22+
md5_password:
23+
description: The MD5 password configured for the project, if set.
24+
type: string
25+
multihop:
26+
description: True when the BGP session should be configured as multihop.
27+
type: boolean
28+
peer_as:
29+
description: The Peer ASN to use when configuring BGP on your device.
30+
example: 65530
31+
format: int32
32+
type: integer
33+
peer_ips:
34+
description: A list of one or more IP addresses to use for the Peer IP section
35+
of your BGP configuration. For non-multihop sessions, this will typically be
36+
a single gateway address for the device. For multihop sessions, it will be a
37+
list of IPs.
38+
example:
39+
- 169.254.255.1
40+
- 169.254.255.2
41+
items:
42+
type: string
43+
type: array
44+
routes_in:
45+
description: A list of project subnets
46+
example:
47+
- exact: true
48+
route: 10.32.16.0/31
49+
items:
50+
$ref: "./BgpRoute.yaml"
51+
type: array
52+
routes_out:
53+
description: A list of outgoing routes. Only populated if the BGP session has
54+
default route enabled.
55+
example:
56+
- exact: true
57+
route: 0.0.0.0/0
58+
items:
59+
$ref: "./BgpRoute.yaml"
60+
type: array
61+
type: object

0 commit comments

Comments
 (0)