-
Notifications
You must be signed in to change notification settings - Fork 74
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
Document interaction with http4s Router and relative paths #152
Comments
That is a protocol-specific concern, and for the "simpleRestJson" protocol, the implicit rule is that the API spec should contain absolute paths. The rationale is as follows :
Facilitating shifting would break that paradigm. That being said, the fact that it doesn't work is somewhat accidental, and I'd like to understand why. But I'm not sure I want to fix it, since the bug is, in essence, a happy accident 😅. You are correct in the fact that it ought to be documented |
https://smithy.io/2.0/spec/http-bindings.html?highlight=http#uri
It's fine that As for why it doesn't work, I believe Smithy4s doesn't look at |
Let's say you define your smithy ops as mounted at root:
If you then build the routes using
val routes = SimpleRestJsonBuilder.routes(...).resource
, you can't just shift the API to a custom prefix:The request to
/api/bla
will fail with 404.This approach will work with manually defined routes, e.g.
The request to
/api/hello/bla
will succeed.I don't know exactly whether the recommendation should be writing absolute paths in the smithy files, or whether this should be considered undesired behaviour. Note that it will obviously affect the generated Swagger docs as well.
The text was updated successfully, but these errors were encountered: