-
Notifications
You must be signed in to change notification settings - Fork 23
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
feat(webapp): introduce openapi/swagger specification #2425
Conversation
- OpenApi/Swagger can be found under: http://localhost:3001/swagger-ui - Redoc can be found under: http://localhost:3001/redoc
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.
Nice! Just some style comments.
#[serde(with = "bitcoin::amount::serde::as_sat::opt")] | ||
pub coordinator_reserve: Option<Amount>, | ||
#[serde(with = "bitcoin::amount::serde::as_sat::opt")] | ||
pub trader_reserve: Option<Amount>, |
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 bit annoying.
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.
I know :( We could potentially wrap it into another type and then imple ToSchema
but I found this was the easiest way.
let router = Router::new() | ||
.route("/", get(index_handler)) | ||
.route("/main.dart.js", get(main_dart_handler)) | ||
.route("/flutter.js", get(flutter_js)) | ||
.route("/index.html", get(index_handler)) | ||
.route("/assets/*file", get(static_handler)) | ||
.route("/api/version", get(version)) | ||
.merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", ApiDoc::openapi())) | ||
.merge(Redoc::with_url("/redoc", ApiDoc::openapi())) |
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.
❓Did you miss /api-docs/
here?
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.
No, Afaik /swagger-ui
needs to find the specification under /api-docs/openapi.json
. redocs
has its own. We probably only need one of them.
Co-authored-by: Lucas Soriano <lucas@10101.finance>
It is a bit of manual work and boiler plates but once set up it's quite nice.
I've enabled redoc and swagger UI for now but I guess one of them is enough
Note: our authentication seems to be non-standard, and hence, it does not fit to the Swagger authentication. Imho we should fix this to have a fully working swagger client. Supported authentication schemes can be found here
Helps with #2284