Stoplight prism returning null when referencing a .json file in .yaml using $ref

86 Views Asked by At

I have a .yaml file, api_spec.yaml, and it's up and running. Inside, there's one endpoint (paths:) where I'm trying to refer to the entire request_payload.json file, stored in the same directory as api_spec.yaml.

  /users:
    get:
      summary: Get a list of users
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: 'request_payload.json'

However, when I tries to retrieve the object by using http GET http://127.0.0.1:4010/users, it's giving a 200 OK status, but the response body looks like

[
    null
]

How can I retrieve the entire object? I will attach my request_payload.json down as well:

{
  "users": [
    {
      "id": 1,
      "name": "John Doe"
    },
    {
      "id": 2,
      "name": "Jame Smith"
    }
  ]
}

I tried using both curl and http command to run, and it's producing the same result.

0

There are 0 best solutions below