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

Fix orderbook openapi scheme #1208

Merged
merged 15 commits into from
Mar 6, 2023
Merged

Fix orderbook openapi scheme #1208

merged 15 commits into from
Mar 6, 2023

Conversation

shoom3301
Copy link
Contributor

@shoom3301 shoom3301 commented Feb 14, 2023

Fixes cowprotocol/cowswap#2045

To avoid code duplication and have one source of truth we decided to generate typescript code based on Swagger scheme:
cowprotocol/cow-sdk#97

This PR levels out contradictions between the openapi scheme and the implementation.

@nlordell
Copy link
Contributor

Wow, Thanks!

Copy link

@anxolin anxolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To prevent discrepancies into the API and swagger, would it be a good idea to auto-generate the swaggers using a Macro?

@vkgnosis
Copy link
Contributor

To prevent discrepancies into the API and swagger, would it be a good idea to auto-generate the swaggers using a Macro?

It would be nice to generate the rust code for using and serving the API from the openapi spec, yes. I'm not aware of a tool that can do this. But it's been a while since we checked that.

@shoom3301 shoom3301 marked this pull request as ready for review February 28, 2023 08:53
@shoom3301 shoom3301 requested a review from a team as a code owner February 28, 2023 08:53
@shoom3301 shoom3301 enabled auto-merge (squash) February 28, 2023 09:42
Copy link
Contributor

@vkgnosis vkgnosis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised the missing types weren't found by our openapi linter.

@github-actions
Copy link

github-actions bot commented Mar 6, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@anxolin
Copy link

anxolin commented Mar 6, 2023

To prevent discrepancies into the API and swagger, would it be a good idea to auto-generate the swaggers using a Macro?
It would be nice to generate the rust code for using and serving the API from the openapi spec, yes. I'm not aware of a tool that can do this. But it's been a while since we checked that.

In case it helps
Automated OpenAPI (AKA Swagger) document generation for Rust/Rocket projects.
Not sure how well it works

https://github.com/GREsau/okapi

Also https://lib.rs/crates/utoipa-gen

Utoipa crate provides auto generated OpenAPI documentation for Rust REST APIs. It treats code first approach as a first class citizen and simplifies API documentation by providing simple macros for generating the documentation from your code.

@shoom3301
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@shoom3301
Copy link
Contributor Author

recheck

@shoom3301 shoom3301 merged commit e864bf7 into main Mar 6, 2023
@shoom3301 shoom3301 deleted the fix/orderbook-openapi branch March 6, 2023 15:17
@github-actions github-actions bot locked and limited conversation to collaborators Mar 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SDK refactoring
4 participants