Tufin / oasdiff

OpenAPI Diff and Breaking Changes

Home Page:https://www.oasdiff.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

False positive breaking-changes when moving a param from endpoint to path level

reuvenharrison opened this issue · comments

Describe the bug
Comparing two specs with a parameter moved from endpoint level to path level produces wrong errors.
See also #376 (comment)

To Reproduce
Steps to reproduce the behavior:

  1. Run oasdiff changelog base.yaml revision.yaml
  2. With specs below
  3. Receive:
2 changes: 1 error, 1 warning, 0 info
error	[new-required-request-default-parameter-to-existing-path] at data/request_params/required-request-params.yaml
	in API GET /api/test5
		added the new required 'query' request parameter 'emptyPath2' to all path's operations

warning	[request-parameter-removed] at data/request_params/required-request-params.yaml
	in API GET /api/test5
		deleted the 'query' request parameter 'emptyPath2'

Expected behavior
No errors

Base spec:

openapi: 3.0.1
info:
  title: Test API
  version: v1
paths:
  /api/test:
    get:
      operationId: getTest
      parameters:
        - in: query
          name: emptyPath2
          required: true
          schema:
            type: string

Revised spec:

openapi: 3.0.1
info:
  title: Test API
  version: v1
paths:
  /api/test:
    parameters:
      - in: query
        name: emptyPath2
        required: true
        schema:
          type: string
    get:
      operationId: getTest