Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

References to path items are not treated correctly #410

Closed
tfesenko opened this issue Oct 6, 2017 · 0 comments
Closed

References to path items are not treated correctly #410

tfesenko opened this issue Oct 6, 2017 · 0 comments
Assignees

Comments

@tfesenko
Copy link
Member

tfesenko commented Oct 6, 2017

Problem

com.reprezen.swagedit.core.model.Model.find(String) always returns null for path items.
Why is that:

  • Model.nodes is a table which uses un-encoded JsonPointers as the keys, e.g. /paths/~1test~1{id}
  • Model.find look-ups the Model.nodes using encoded JsonPointers for path items, e.g. #/paths/~1test~1%7Bid%7D

Symptoms

The symptoms below are true for reference to path items with { or }

1 You can use a reference to a path item anywhere and the validator will be OK with it.

Example:

---
openapi: "3.0.0"
info:
  version: "1.0.0"
  title: Test API
  
paths:
  /test/{id}:
    get:
      summary: Read
      description: Provide details for the entire list (for collection resources) or an item (for object resources)
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                # This is a reference to the parent path item,
                # but i should be a reference to a schema!!!
                $ref: "#/paths/~1test~1%7Bid%7D"

2 operationRef shows a validation error when operation path has { or }

At the same time, if you try to use a reference to child operation in a valid context as a value for operationRef, it creates an error about an incorrect type:

---
openapi: "3.0.0"
info:
  version: "1.0.0"
  title: Test API
  
paths:
  /test/{id}:
    get:
      summary: Read
      description: Provide details for the entire list (for collection resources) or an item (for object resources)
      responses:
        '200':
          description: OK

components:
  links:
    myLink:
      # A valid ref creates an error
      operationRef: "#/paths/~1test~1%7Bid%7D/get"
@tfesenko tfesenko assigned ghillairet and unassigned ghillairet Oct 6, 2017
tfesenko added a commit that referenced this issue Oct 11, 2017
[#410] References to path items are not treated correctly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants