Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No breaking change reported in referenced query parameter #567

Closed
rickdgeerling opened this issue Jun 26, 2024 · 1 comment · Fixed by #570
Closed

No breaking change reported in referenced query parameter #567

rickdgeerling opened this issue Jun 26, 2024 · 1 comment · Fixed by #570
Labels
bug Something isn't working

Comments

@rickdgeerling
Copy link

rickdgeerling commented Jun 26, 2024

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
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
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):

  • Linux 6.1.92-1-MANJARO #1 SMP PREEMPT_DYNAMIC Mon May 27 03:37:00 UTC 2024 x86_64 GNU/Linux
  • go version go1.22.3 linux/amd64

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

@rickdgeerling rickdgeerling added the bug Something isn't working label Jun 26, 2024
@reuvenharrison
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants