LiveRamp / reslang

A language for describing resource-oriented APIs & turning them into Swagger or resource diagrams. Oriented around the concepts we want to expose in the APIs.
Apache License 2.0
23 stars 7 forks source link

StandardError does not exist #16

Closed lmossman closed 4 years ago

lmossman commented 4 years ago

I have tried using StandardError in a reslang definition in the following way:

asset-resource Object {
    id: int
    /operations
        GET
            "Cannot find Object" 404
                 StandardError
}

I am able to successfully generate the swagger yaml for this reslang, but when I try to view the swagger yaml in redoc, I get the following error:

lmossm:reslang$ redoc-cli serve --watch swagger.yaml
{
  ssr: undefined,
  watch: true,
  templateFileName: undefined,
  templateOptions: {},
  redocOptions: {}
}
SyntaxError: Error resolving $ref pointer "/Users/lmossm/code/reslang/swagger.yaml#/components/schemas/StandardError".
Token "StandardError" does not exist.
    at Pointer.resolve (/usr/local/lib/node_modules/redoc-cli/node_modules/json-schema-ref-parser/lib/pointer.js:87:17)
    at $Ref.resolve (/usr/local/lib/node_modules/redoc-cli/node_modules/json-schema-ref-parser/lib/ref.js:83:18)
    at $Refs._resolve (/usr/local/lib/node_modules/redoc-cli/node_modules/json-schema-ref-parser/lib/refs.js:155:15)
    at inventory$Ref (/usr/local/lib/node_modules/redoc-cli/node_modules/json-schema-ref-parser/lib/bundle.js:98:23)
    at /usr/local/lib/node_modules/redoc-cli/node_modules/json-schema-ref-parser/lib/bundle.js:73:11
    at Array.forEach (<anonymous>)
    at crawl (/usr/local/lib/node_modules/redoc-cli/node_modules/json-schema-ref-parser/lib/bundle.js:67:12)
    at /usr/local/lib/node_modules/redoc-cli/node_modules/json-schema-ref-parser/lib/bundle.js:76:11
    at Array.forEach (<anonymous>)

This error is stated in the reslang reference as an "internally defined structure that should be used for most errors". So it seems like this structure is mistakenly missing from the reslang code.

Here is the relevant slack thread that brought attention to this issue: https://liveramp.slack.com/archives/CPBAEKS9X/p1583285945043000

liveandrew commented 4 years ago

Fixed here: https://github.com/LiveRamp/reslang/commit/1411a6eaea287aab6b298a559f7f2ec42e6b945a