Skip to content

False positive diff if array has minItems #779

Closed
@danilofuchs

Description

@danilofuchs

Given this simple schema, with a body containing a property with type array and minItems: 2

{
  "openapi": "3.1.0",
  "info": {
    "version": "1.0.0",
    "title": "Example"
  },
  "paths": {
    "/assets/merge": {
      "post": {
        "operationId": "mergeAssets",
        "tags": ["Management Assets"],
        "description": "Merges multiple assets into one",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": ["object"],
                "properties": {
                  "assetIds": {
                    "type": ["array"],
                    "items": {
                      "type": ["string"]
                    },
                    "minItems": 2
                  }
                },
                "required": ["assetIds"]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": ["object"],
                  "properties": {
                    "mergedAssetId": {
                      "type": ["string"]
                    }
                  },
                  "required": ["mergedAssetId"]
                }
              }
            }
          }
        },
        "deprecated": false,
        "parameters": []
      }
    }
  }
}
docker run --rm -t \
            -v $(pwd)/specs:/specs \
            openapitools/openapi-diff:latest \
            /specs/o.json \
            /specs/o.json

==========================================================================
==                            API CHANGE LOG                            ==
==========================================================================
                                 Example                                  
--------------------------------------------------------------------------
--                            What's Changed                            --
--------------------------------------------------------------------------
- POST   /assets/merge
  Request:
        - Changed application/json
          Schema: Backward compatible
--------------------------------------------------------------------------
--                                Result                                --
--------------------------------------------------------------------------
                   API changes are backward compatible                    
--------------------------------------------------------------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions