Skip to content

Different parameter description should not cause ConsumerDrivenValidator to fail #40

Description

@alansegar

From v0.7.0 a change in behaviour was introduced by PR #25 which fixes issue #24 . Prior to v0.7.0 a difference between the description on a parameter would not cause a failure. This change isn't an essential part of the fix for issue #24 and I don't believe it was intentional.

    "parameters": [
                    {
                        "in": "path",
                        "name": "petId",
                        "description": "ID of pet that needs to be fetched",
                        "required": true,
                        "type": "integer",
                        "format": "int64"
                    }
                ]
                "parameters": [
                    {
                        "in": "path",
                        "name": "petId",
                        "description": "Deliberately different description text",
                        "required": true,
                        "type": "integer",
                        "format": "int64"
                    }
                ]

The use of contains and equals in v0.7.0 caused all attributes to be compared rather than just name. According to https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameterObject

A unique parameter is defined by a combination of a name and location.

so I've used name and location (in) rather than just name. This fixes #24 without any side effects.
I've created a PR #39 for the fix.
I used the v0.6.0 code as a base for this fix https://github.com/RobWin/assertj-swagger/blob/v0.6.0/src/main/java/io/github/robwin/swagger/test/ConsumerDrivenValidator.java#L240

That made me notice that https://github.com/RobWin/assertj-swagger/blob/master/src/main/java/io/github/robwin/swagger/test/ConsumerDrivenValidator.java#L305 doesn't validate some other attributes on path parameters . I think it makes sense to ignore differences in description text, but it may make sense to validate some of the others e.g. format, required , etc

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions