-
Notifications
You must be signed in to change notification settings - Fork 912
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
Clnrest: dynamic paths #7529
base: master
Are you sure you want to change the base?
Clnrest: dynamic paths #7529
Conversation
Changelog-Changed: clnrest is now a rust plugin
35593be
to
2e2d66e
Compare
Changelog-Added: clnrest: add support for dynamic paths
2e2d66e
to
8c16178
Compare
@@ -131,7 +153,7 @@ async fn main() -> Result<(), anyhow::Error> { | |||
"/v1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding v1
to all custom endpoints might prove problematic if someone's attempting to match an external spec.
In the case of cashu, which is currently v1
, this is fine but in the case that cashu
moves to v2 this will cause problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a very good point. The versions are not correlated and could change independently. Do we need to add a version field to the clnrest manifest data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's also possible to have specs that don't include the version part of the path!
I think there's two options here:
- add an optional "version" field which defaults to the current CLN rest one. it can be set to 'null' which removes it entirely.
- don't add the version to the endpoint but instead have rpcs add it to their
path
explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also would be problematic for cashu if clnrest moves to v2, but cashu does not
add an optional "version" field which defaults to the current CLN rest one. it can be set to 'null' which removes it entirely.
This would help maintain a static endpoint if clnrest bumps its version
based on #7507, #7508 and #7509
Adds the capability for clnrest to handle dynamic paths registered via a plugin's manifest. Supports the http methods
GET
andPOST
and arbitrarycontent-type
's for responses. The most specific path is chosen if there are multiple matches.lightningd
is responsible for making sure no ambigous paths like/path/to/<me>
and/path/to/<you>
are registered.