Skip to content

application/vnd.api+json in yml files loses the + on resolve #249

@langalex

Description

@langalex

Running my openapi.yml file though speccy resolve creates invalid files when keys include a + symbol.

Detailed description

My openapi.yml file includes keys that contain a + (file abbreviated for clarity):

get:
  responses:
    200:
      content:
        application/vnd.api+json:
          schema:
            $ref: xyz.json

When running this file through speccy resolve, the resolved file contains the original application/vnd.api+json plus another key on the same level where the plus has been replaced with a space (application/vnd.api json) and the $ref pointing (but incorrectly) to the newly inserted key.

get:
  responses:
    200:
      content:
        application/vnd.api+json:
          schema:
            $ref: "#/paths/get/responses/200/content/application~1vnd.api%2Bjson/schema"
        application/vnd.api json:
          schema:
            some: resolved data

The %2B in the $ref is actually a + again when running it through decodeURIComponent. It looks like somewhere these keys are www-form encoded back and forth and the created the wrong keys.

When removing the +, everythung works as expected and there is no more duplicate key.

I think this is a bug. Not sure if in speccy or one of the dependencies.

Your environment

Metadata

Metadata

Assignees

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