Commit 6f1d634
committed
Normalize relative ref paths to avoid duplicating schemas
Currently, if an OpenAPI spec contains multiple relative refs to
the same file, but those refs are located in different files and
use different relative paths to reach the one file, swagger-parser
will create a separate, duplicate schema for each relative path
rather than reusing the same schema across all equivalent paths.
For example, given a spec with the following refs:
- In spec root directory, `$ref: ./components/schemas/Thing.yaml`
- In components/paths subdirectory, `$ref: ../../components/schemas/Thing.yaml`
The parser will produce a `Thing` and a `Thing_1` schema object
instead of reusing `Thing` for the second, equivalent reference.
This updates the ref processor to resolve relative paths before
processing relative refs in order to produce a single `Thing` schema
that is reused for all equivalent references.1 parent 5040b8b commit 6f1d634
364 files changed
Lines changed: 15103 additions & 1 deletion
File tree
- modules/swagger-parser-v3/src
- main/java/io/swagger/v3/parser/processors
- test
- java/io/swagger/v3/parser/test
- resources/oas3.fetched
- components
- parameters
- requestBodies
- schemas
- paths
- api-keys
- batches
- bgp-dynamic-neighbors
- bgp/sessions
- capacity
- connections
- connection_id
- ports
- id
- port_id
- devices
- id
- bgp
- diagnostics
- health
- instance_id/ips/id
- emails
- events
- hardware-reservations
- id
- invitations
- invoices
- ips
- id
- licenses
- locations
- metros
- market/spot
- prices
- memberships
- metal-gateways
- id
- organizations
- id
- capacity
- organization_id
- payment-methods
- ports
- id
- convert
- vlan-assignments
- batches
- projects
- id
- bgp
- devices
- project_id
- ips/id
- self-service
- reservations
- routes
- id
- spot-market-requests
- ssh-keys
- transfers
- userdata
- users
- id
- user
- api-keys
- otp
- sms
- verify
- virtual-circuits
- id
- virtual-networks
- vrfs
- id
- vrf_id/ips
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
89 | 103 | | |
90 | 104 | | |
91 | 105 | | |
| |||
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1953 | 1953 | | |
1954 | 1954 | | |
1955 | 1955 | | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
1956 | 1968 | | |
1957 | 1969 | | |
1958 | 1970 | | |
| |||
3286 | 3298 | | |
3287 | 3299 | | |
3288 | 3300 | | |
3289 | | - | |
| 3301 | + | |
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
0 commit comments