Skip to content

Warn message is missing when the path key doesn't start with slash #892

@ymohdriz

Description

@ymohdriz

Hi team,

As per the open api spec, all the keys in the paths map should start with '/' as mentioned https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#pathsObject

Field Pattern Type Description
/{path} Path Item Object A relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended (no relative URL resolution) to the expanded URL from the Server Object's url field in order to construct the full URL. Path templating is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it's up to the tooling to decide which one to use.

Expectation:
When a path is not starting with '/', then parser should warn.

Below is the failing test:
@test
public void testSimple() {
SwaggerParseResult result = new OpenAPIParser().readLocation("petstore.yaml", null, null);
assertEquals(result.getMessages().size(), 1);
}

Thanks,
Mohammed Rizwan

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions