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

Collection agaist schema doesn't support validation correctly for allOf keyword for provided schema. #597

Open
VShingala opened this issue Jul 11, 2022 · 0 comments
Assignees
Labels
importer improvement Issue is for improvement of existing flow. validation Concerns validation flow of module.

Comments

@VShingala
Copy link
Member

In this case (API schema below), the user expects that the test data they pass should be invalid because specificType property value does not contain a grandParentTypeData property. However, Postman reports the data as valid.

Reproduction steps (In app):

  • Import the schemas inside Postman
  • Generate a collection for them
  • Create a mock server for each collection
  • Send a request from the generated collections
  • See that NO validation issues are shown, even though there should be issues

Reproduction steps (In module):

  • Use validateTransaction() API to generate result from API and generated collection from it.

API schema:

{
    "info": {
        "title": "Inheritance test API",
        "version": "v1.0"
    },
    "openapi": "3.0.1",
    "paths": {
        "/api/inheritancetest": {
            "get": {
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Page"
                                }
                            }
                        },
                        "description": "The page data including metadata and content"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "SpecificType": {
                "allOf": [{
                        "$ref": "#/components/schemas/ParentType"
                    }, {
                        "properties": {
                            "specificTypeData": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "specificTypeData"
                        ]
                    }
                ]
            },
            "ParentType": {
                "allOf": [{
                        "$ref": "#/components/schemas/GrandParentType"
                    }, {
                        "properties": {
                            "parentTypeData": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "parentTypeData"
                        ]
                    }
                ]
            },
            "GrandParentType": {
                "properties": {
                    "grandParentTypeData": {
                        "type": "string"
                    }
                },
                "required": [
                    "grandParentTypeData"
                ]
            },
            "Page": {
                "allOf": [{
                        "$ref": "#/components/schemas/GrandParentType"
                    }, {
                        "properties": {
                            "specificType": {
                                "$ref": "#/components/schemas/SpecificType"
                            }
                        },
                        "required": [
                            "specificType"
                        ]
                    }
                ]
            }
        },
        "securitySchemes": {
            "basic": {
                "description": "Basic HTTP Authentication",
                "scheme": "basic",
                "type": "http"
            }
        }
    }
}
@VShingala VShingala added improvement Issue is for improvement of existing flow. validation Concerns validation flow of module. labels Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
importer improvement Issue is for improvement of existing flow. validation Concerns validation flow of module.
Projects
None yet
Development

No branches or pull requests

2 participants