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
plutus-pab: Adds Swagger support for web-server API #3807
Conversation
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.
You need to run ./updateMaterialized inside nix-shell to update nix files.
@nau done! |
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.
Making the API self-describing is generally very useful and will make it much easier to generate clients in other languages. We looked at swagger a while ago and the issue that prevented us from using it was lack of support for sum types. But it looks like a new major version of swagger/open API is out so maybe it's time to revisit this.
How does OpenAPI3 handle sum types? For example what does the schema for UniswapContracts
look like?
Hey @j-mueller the |
The
Sorry what is the issue exactly? That the types of the elements of the list aren't specified? In general, encoding a tuple as a heterogeneous list with a fixed length is fine (that is what a tuple is, and that's the default encoding that |
This PR adds package dependencies to |
I don't think we should add a dependency on |
But they're used in these module: Is there some other way to include dependencies to packages? |
No they aren't. You added |
@j-mueller @michaelpj I've added the changes for orphan instances: put them on |
I think the merging of this PR has taken enough time. I'm stuck at |
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'd like to get a second opinion from @silky before merging, but it looks good to me now.
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.
Looks great to me! Thanks for doing this work. I've added a couple of small suggestions, then I'm happy to merge!
|
@silky you can also just do a squash-merge if you like |
Ah thanks @michaelpj ; I looked at 'rebase and merge; only :) -- Edit: Thanks @kelizarov for your work on this! |
This PR still adds a dependency on |
Hi @michaelpj May I ask how this affects the developers waiting to make use of the solutions in this PR? I, for one, have been stuck for like a week waiting for it to be merged. |
It shouldn't affect you. I have generously decided not to revert it and instead to let it be fixed in a subsequent PR :) |
* Add swagger support via openapi3 Co-authored-by: Danil Berestov <GooseDB@yandex.ru>
This change adds a support for swagger using servant-openapi that generates an OpenAPI spec for PAB API with descriptions to provide a non-technical information for how endpoints behave and what they expect in requests and responses.
The swagger-ui is accessible through
swagger/swagger-ui/index.html
The example of UI:
Pre-submit checklist: