diff --git a/collator.go b/collator.go index c2d9c59c..8fe86359 100644 --- a/collator.go +++ b/collator.go @@ -244,11 +244,7 @@ var cmpComponents = cmp.Options{ // Refs themselves can mutate during relocation, so they are excluded from // content comparison. cmp.FilterPath(func(p cmp.Path) bool { - switch p.Last().String() { - case ".Ref", ".Description", ".Example", ".Summary": - return true - } - return false + return p.Last().String() == ".Ref" }, cmp.Ignore()), } diff --git a/collator_test.go b/collator_test.go index 36312e1a..f70e2951 100644 --- a/collator_test.go +++ b/collator_test.go @@ -96,6 +96,10 @@ func TestCollator(t *testing.T) { "\"Requested API version\",\"pattern\":\"^(wip|work-in-progress|experimental|beta|((([0-9]{4})-([0-1][0-9]))"+ "-((3[01])|(0[1-9])|([12][0-9]))(~(wip|work-in-progress|experimental|beta))?))$\",\"type\":\"string\"}}\n", qt.JSONEquals, exampleParameterRef.Value) + projectConflictRef := result.Paths["/orgs/{orgId}/projects"].Get.Parameters[6] + exampleConflictRef := result.Paths["/examples/hello-world/{id}"].Get.Parameters[3] + c.Assert(projectConflictRef.Ref, qt.Not(qt.Equals), exampleConflictRef.Ref) + projectResp400Ref := result.Paths["/orgs/{orgId}/projects"].Get.Responses["400"] c.Assert(projectResp400Ref.Ref, qt.Equals, "#/components/responses/400") exampleResp400Ref := result.Paths["/examples/hello-world/{id}"].Get.Responses["400"] diff --git a/testdata/conflict-components/_examples/2021-06-01/spec.yaml b/testdata/conflict-components/_examples/2021-06-01/spec.yaml index b21bd215..3e2ba94d 100644 --- a/testdata/conflict-components/_examples/2021-06-01/spec.yaml +++ b/testdata/conflict-components/_examples/2021-06-01/spec.yaml @@ -20,6 +20,7 @@ paths: required: true schema: type: string + - $ref: '#/components/parameters/Conflict' responses: '400': { $ref: 'https://raw.githubusercontent.com/snyk/sweater-comb/v1.2.2/components/responses/400.yaml#/400' } '401': { $ref: 'https://raw.githubusercontent.com/snyk/sweater-comb/v1.2.2/components/responses/401.yaml#/401' } @@ -43,6 +44,14 @@ paths: additionalProperties: false components: + parameters: + Conflict: + name: conflict + in: query + required: true + description: Initial conflict description + schema: + type: string schemas: HelloWorld: type: object diff --git a/testdata/conflict-components/projects/2021-06-04/spec.yaml b/testdata/conflict-components/projects/2021-06-04/spec.yaml index 43523ae2..3eb9a076 100644 --- a/testdata/conflict-components/projects/2021-06-04/spec.yaml +++ b/testdata/conflict-components/projects/2021-06-04/spec.yaml @@ -17,6 +17,13 @@ components: description: The requested version of the endpoint to process the request schema: type: number + Conflict: + name: conflict + in: query + required: true + description: Different conflict description + schema: + type: string schemas: JsonApi: type: object @@ -78,6 +85,7 @@ paths: type: array items: type: string + - $ref: '#/components/parameters/Conflict' responses: '400': { $ref: '../../../resources/schemas/responses/400.yaml#/400' } '401': { $ref: 'https://raw.githubusercontent.com/snyk/sweater-comb/v1.2.2/components/responses/401.yaml#/401' }