spot
spot copied to clipboard
Not possible to use custom methods in paths
Describe the bug It seems that it's not possible to use custom methods in endpoint paths.
To Reproduce
@api({ name: "test", version: "1" })
class Api {}
@endpoint({
method: "POST",
path: "/items/:id:run",
})
class RunItem {
@request
request(
@pathParams
pathParams: {
id: string;
}
) {}
@response({ status: 202 })
successfulResponse() {}
}
Running spot generate --contract src/contract/api.ts --language yaml --generator openapi3 --out tst/
throws an error:
Error: endpoint path dynamic components must have a corresponding path param defined in @request. Violating path components: id:run
I think it's because this function for the example above will return ['id:run']
and this string is then expected to be defined in pathParams
.
Expected behavior To generate openapi spec without an error.
Desktop:
- OS: Ubuntu
- Node version: v14.17.0
- Spot version: 1.9.0