Skip to content

[OpenAPI] URI reference syntax errors #3079

@lcawl

Description

@lcawl

When you run the make lint-docs command, which runs the Spectral linter against the OpenAPI output, it has a lot of this type of message:

 428:21       warning  oas3-schema                 "$ref" property must match format "uri-reference".                                  paths./_async_search.post.parameters[1].$ref

This linting rule is https://docs.stoplight.io/docs/spectral/4dec24461f3af-open-api-rules#oas3-schema but in particular it's checking the format of URI references like this:

{
  "$ref": "#/components/parameters/async_search.submit#keep_on_completion"
},  

I think it's the presence of the last hashtag that's causing the problem, since when I edited it like this the message disappeared:

  "$ref": "#/components/parameters/async_search.submit_keep_on_completion"

I think hashtags have a reserved meaning in https://www.rfc-editor.org/rfc/rfc3986 and we should fix this in the OpenAPI generator.

When we use the redocly linter, it's capturing the same type of problem with this rule:
https://redocly.com/docs/cli/rules/oas/spec-components-invalid-map-name

... which relates to the following message in https://spec.openapis.org/oas/v3.0.3#fixed-fields-5

"All the fixed fields declared above are objects that MUST use keys that match the regular expression: ^[a-zA-Z0-9.-_]+$."

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions