Skip to content

If servers.url does not contain :// the schemes match will fail #410

@sljeff

Description

@sljeff

If there is a yaml like this:

servers:
- url: /abc

Then Validator must fail. Because schemes are parsed as []string{"/abc"}.


According to the example in the Server URL Format subsection of OpenAPI document, / /v1/reports are also legal URLs.

Although the scheme://host[:port][/path] above is inconsistent, many places that don't require scheme and host validation already use something like /path.

This place may need to be optimized https://github.com/getkin/kin-openapi/blob/v0.74.0/routers/gorillamux/router.go#L38


Additional:

If I don't want to verify the host now, I can change

servers:
- url: /abc

to

servers:
- url: http:///abc

But if I want to not check scheme, there seems to be no way now?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions