You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
In principle, it's enough to write applications, I have about this kind of communication. But there is no execution of the contract of request handlers here. There is no obligation to correctly process the request body in the handler. I could not find a way to do it through actix_web::dev::Factory.
By actix-swagger:
I will now write a conversion of yaml structures to the code generator format. Most likely there will be a HashMap/BTreeMap bundle to correctly resolve links. The first implementation will be very stupid and will be able to work only with links in requestBody, params and so on. There will also be no support for importing from files.
What do you need help with?
Have a look at the code. Almost everything is written there to get the first working version.
It would be cool to throw tests on the code generator (called printer). I think trivial inline snapshots would be enough. Give different configuration options to input and get sane code.
Convert your personal openapi3 snapshots into cargo-swagg structures and see if it's enough to have or need something else. If you need something else, create an issue/pr with implementation.
Project goals:
To input the openapi3 specification, to get the generated code at the output that does not need to be corrected by hand. At the same time, you may commit it into the repo and watch changes in the guitar after manual re-generation. You can take it to a separate crate, re-generate it into ci and deploy the crate of the new version. Update it in the project when it is convenient.
how to get the request handler to execute the contract on the request body, query, and headers.
I was thinking of making my analogue actix_web::dev::Factory, the so-called BoundFactory. Which would prescribe the implementation for Fn. BoundFactory is a trait that requires a function to have several mandatory parameters for specific types.
In this way, handlers could have the first arguments of clear types, such as request_body: request_bodies::Example, query: session_create::Query, and the rest of the arguments would be derived types, so you can pull out the necessary things, such as actix_web::web::Data.
https://t.me/rustlang_ru/285259 https://teleg.one/rustlang_ru/285259 (Russian)
Translated:
made a sufficient version of the code generator for actix_swagger.
Generates this: https://github.com/sergeysova/actix-swagger/blob/master/cargo-swagg/out.rs.
In principle, it's enough to write applications, I have about this kind of communication. But there is no execution of the contract of request handlers here. There is no obligation to correctly process the request body in the handler. I could not find a way to do it through
actix_web::dev::Factory
.Here is a discussion issue: actix/actix-web#1339.
By actix-swagger:
I will now write a conversion of yaml structures to the code generator format. Most likely there will be a HashMap/BTreeMap bundle to correctly resolve links. The first implementation will be very stupid and will be able to work only with links in requestBody, params and so on. There will also be no support for importing from files.
What do you need help with?
Project goals:
To input the openapi3 specification, to get the generated code at the output that does not need to be corrected by hand. At the same time, you may commit it into the repo and watch changes in the guitar after manual re-generation. You can take it to a separate crate, re-generate it into ci and deploy the crate of the new version. Update it in the project when it is convenient.
How to use:
actix_swagger::Response
is used as theactix_web::Response
analogue with explicit response types to verify that the request handler implements the contract.We have to figure this out:
how to get the request handler to execute the contract on the request body, query, and headers.
I was thinking of making my analogue actix_web::dev::Factory, the so-called BoundFactory. Which would prescribe the implementation for Fn. BoundFactory is a trait that requires a function to have several mandatory parameters for specific types.
In this way, handlers could have the first arguments of clear types, such as request_body: request_bodies::Example, query: session_create::Query, and the rest of the arguments would be derived types, so you can pull out the necessary things, such as actix_web::web::Data.
But I'm relying on the privacy of Handler - actix/actix-web#1339.
I did not understand how to implement BoundFactory or even achieve the goal through Handle trait (actix/actix-web#1275).
I'd be so grateful for any help.
The text was updated successfully, but these errors were encountered: