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

Not possible to use custom methods in paths #1668

Open
seba-ban opened this issue Oct 20, 2021 · 0 comments
Open

Not possible to use custom methods in paths #1668

seba-ban opened this issue Oct 20, 2021 · 0 comments

Comments

@seba-ban
Copy link

seba-ban commented Oct 20, 2021

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant