Re:Show HN: Rust Web Framework
by fmbb on Tuesday October 22, 2024 @12:26PM
(#41915941)
Know of any similar frameworks that work the other way around? Where you can Keep an openapi definition as the source of truth and validate that your server follows it, I mean.
[ Parent
| on HN ]
Re:Show HN: Rust Web Framework
by florianmartens on Tuesday October 22, 2024 @01:34PM
(#41916614)
I agree. API-first is the way! Change your schema, auto-generate types into your code and use them for your server definition. It's just faster and more secure this way. Use api-fiddle.com or spotlight.io to work with the schemas (branching, sync with Github).
In a fully typesafe world, it should be pretty hard to derive from the shema this way.
Re:Show HN: Rust Web Framework
by JamesSwift on Tuesday October 22, 2024 @02:13PM
(#41917044)
Rswag is still my favorite openapi-related project. You write integration tests against the server and get an openapi spec as output. But thats for rails.
Just have to be a bit careful mentioning it in front of non tech folks who'll inevitably ask "what's arsewag?"
Re:Show HN: Rust Web Framework
by giancarlostoro on Tuesday October 22, 2024 @01:01PM
(#41916288)
As others suggested, I would diff against a generated one, then potentially treat the generated one as source of truth in the future... Then diff accordingly as it changes.
Re:Show HN: Rust Web Framework
by internetter on Tuesday October 22, 2024 @12:31PM
(#41916011)
You can simply diff it. Define the OpenAPI spec, have the framework generate a spec, compare.