Tufin / oasdiff

OpenAPI Diff and Breaking Changes
https://www.oasdiff.com
Apache License 2.0
663 stars 59 forks source link

No breaking change reported in referenced query parameter #567

Closed tuxmachine closed 1 month ago

tuxmachine commented 2 months ago

Describe the bug

See attached base and revision specs. There's a breaking change in the query parameters, going from type number to string, presumably because the change is inside a referenced component.

This change is detected by oasdiff diff base.yaml revision.yaml correctly, but oasdiff breaking reports no changes and exits with status code 0

To Reproduce

base.json ```yaml openapi: 3.0.1 paths: /groups: get: operationId: getGroups summary: Get groups parameters: - name: skip required: false in: query schema: type: string - name: take required: false in: query schema: type: string - name: filters required: false in: query style: deepObject explode: true schema: $ref: '#/components/schemas/GroupFilters' responses: "200": description: Successfully received results content: application/json: schema: type: object title: BaseGroupListResponse required: - total - skip - take - results properties: total: type: integer skip: type: integer take: type: integer results: type: array items: $ref: '#/components/schemas/BaseGroup' info: title: Backend description: "" version: v1 contact: {} tags: [] servers: [] components: schemas: GroupFilters: type: object properties: groupId: # # 👇🏻 Breaking change here # type: number nullable: true name: type: array items: type: string BaseGroup: type: object properties: groupId: type: number name: type: string required: - groupId - name ```
revision.json ```yaml openapi: 3.0.1 paths: /groups: get: operationId: getGroups summary: Get groups parameters: - name: skip required: false in: query schema: type: string - name: take required: false in: query schema: type: string - name: filters required: false in: query style: deepObject explode: true schema: $ref: '#/components/schemas/GroupFilters' responses: "200": description: Successfully received results content: application/json: schema: type: object title: BaseGroupListResponse required: - total - skip - take - results properties: total: type: integer skip: type: integer take: type: integer results: type: array items: $ref: '#/components/schemas/BaseGroup' info: title: Backend description: "" version: v1 contact: {} tags: [] servers: [] components: schemas: GroupFilters: type: object properties: groupId: # # 👇🏻 Breaking change here # type: string nullable: true name: type: array items: type: string BaseGroup: type: object properties: groupId: type: number name: type: string required: - groupId - name ```
oasdiff diff output ``` paths: modified: /groups: operations: modified: GET: parameters: modified: query: filters: schema: properties: modified: groupId: type: added: - string deleted: - number endpoints: modified: ? method: GET path: /groups : parameters: modified: query: filters: schema: properties: modified: groupId: type: added: - string deleted: - number components: schemas: modified: GroupFilters: properties: modified: groupId: type: added: - string deleted: - number ```

Expected behavior

Expected oasdiff breaking to list the breaking change

Desktop (please complete the following information):

Additional context

Looks related to #280 / #276

I'd hazard a guess that https://github.com/Tufin/oasdiff/blob/main/checker/check_request_parameters_type_changed.go is a good place to start looking

reuvenharrison commented 1 month ago

Hi @tuxmachine, Thanks for the detailed bug report. I am checking this. Reuven