kiranz / just-api

:boom: Test REST, GraphQL APIs
https://kiranz.github.io/just-api/
MIT License
813 stars 35 forks source link

Enhancement: allow JSON pointer to schema within file #37

Open matmar10 opened 4 years ago

matmar10 commented 4 years ago

Use Case

An OpenAPI (FKA Swagger) spec often contains multiple schema definitions, such as #/components/responses/someResponseName

It would be very useful to reuse schema definitions from within the existing files, such as:

specs:
  - name: Some request
    ...
    response:
      json_schema:
        type: file
        $ref: schemas/openapi.json#/components/responses/NotFoundError

This would read the __dirname/schemas/openapi.json and extract the components.responses.NotFoundError property.

I can probably submit a contribution for this but would like to collect thoughts to make sure I implement it correctly.