poem
openapi-generator
poem | openapi-generator | |
---|---|---|
32 | 239 | |
3,647 | 22,027 | |
1.3% | 1.5% | |
8.9 | 9.9 | |
10 days ago | 1 day ago | |
Rust | Java | |
Apache License 2.0 | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
poem
-
Show HN: Rust Web Framework
https://github.com/poem-web/poem is one Rust framework with swagger definitions out of the box.
-
Rust needs a web framework for lazy developers
There is one: Poem[1]
The author mentions flask but looking at the "What we need section", I don't think flask covers those. I hate Djago with a passion but if those are the requirements, I think Django is the one that closely resembles what the author is describing. So Poem is not a good candidate either in that regard. Poem is all in all, something that closely resembles FastAPI, which is actually a complement. I've tried half a dozen rust web frameworks and they all come with a ton of boilerplate fiddling with the initial setup. Which is a problem if you want to get things done fast. In that regard, poem nails it. Yes, actix has a considerably better performance but unless you are aiming for sub-30 millisecond responses, then actix is not what you should be looking at to begin with. Also if you crave a Pydantic, there is a crate that sort of does that for you: https://crates.io/crates/poem-openapi
[1] https://github.com/poem-web/poem
-
Write OpenAPI with TypeSpec
TypeSpec is great, but if you're working with Rust and you're about to write a new project that will require an OpenApi spec sooner or later, I'd like to recommend a web framework that has spec generation baked in:
https://github.com/poem-web/poem (see poem_openapi)
All you need to do is derive a trait on your response structs and in return you get an almost perfectly generated spec. Unions, objects, enums are first class citizens.
Also, if you're from coming from PHP, the controllers feel very much like symfony controllers.
P.s. Please do recommend an ORM that would feel closer to doctrine. I miss doctrine.
-
What is the best API generator for Axum?
I've used FastAPI/Pydantic before as well and it was a very good experience. It has been a while since I used them though, so I forget exactly how they compare, but I do recall it wrote most of the OpenAPI spec. for you. I will also agree when I saw utoipa and aide they seemed to require more boilerplate even though I have not done an actual comparison. Poem, on the other hand, seems very neat and clean and doesn't have any duplication that I can see. Here is the [TODO example](https://github.com/poem-web/poem/blob/master/examples/openapi/todos/src/main.rs).
-
Looking for a Rust API with automatic documentation and good validation?
The example at https://github.com/poem-web/poem/tree/master/examples/openapi/auth-apikey works without issues for me.
-
What library to use for a Websocket Server?
'Poem', it turns to nicer to play with for me than 'Axum'. Example of web socket chat https://github.com/poem-web/poem/blob/master/examples/poem/websocket-chat/src/main.rs
-
Rest API framework in rust
If you need built-in OpenAPI support, I can recommend Poem.
-
(Recommendation Request) Rust REST API framework; similar to Python's FastAPI(Python)
If OpenAPI is important, then you may to consider https://github.com/poem-web/poem instead of axum. It isn't nearly as widely used, but it should still be compatible with everything else.
-
Hey Rustaceans! Got a question? Ask here (3/2023)!
Poem: More rigid and less popular and aims to be easier https://github.com/poem-web/poem
-
A taste of pavex, an upcoming Rust web framework
Did you check out Poem? It seems promising, with openapi generation built in already.
openapi-generator
-
Top 8 Swagger Codegen Alternatives
OpenAPI Generator is a versatile tool that emerged as a fork of Swagger Codegen, offering enhanced support and features. It allows developers to generate API client libraries, server stubs, and documentation for over 30 programming languages.
- OpenAPI Generator: Generate clients, servers from OpenAPI 2.0/3.x documents
-
In-Depth Comparison: How to Choose the Most Suitable Enhanced Request Library
Since @tanstack/react-query and swr give all control of the request to the user, the API automation solution is provided by third-party request tools. For example, axios and fetch can automatically generate request codes through openapi-generator or @openapitools/openapi-generator-cli.
-
Next-generation web framework Teo, supports Node.js, Python and Rust
You would use OpenAPI (formerly Swagger) [1] for that, which includes JSONSchema for data types but also adds specs for defining REST apis. There are plenty of generators and other tools that work with OpenAPI [2]
[1] https://www.openapis.org/
[2] https://openapi-generator.tech/
-
Which tricks do you use to write less code?
I found some "tricks" to write less code, hence less code to maintain if there are any changes. Also less code with bugs just by changing the inputs.
For example, OpenAPI spec file + OpenAPI generator (https://github.com/OpenAPITools/openapi-generator). Any changes in the OpenAPI spec are reflected in the final code with a build step.
Another example: MapStruct (https://mapstruct.org/) to avoid passing data from Entity classes to DTO and back. Saves looots of boilerplate code.
Which are your tricks?
-
The Stainless SDK Generator
Disclaimer: We're an early adopter of Stainless at Mux.
I've spent more of my time than I'd like to admit managing both OpenAPi spec files [1] and fighting with openapi-generator [2] than any sane person should have to. While it's great having the freedom to change the templates an thus generated SDKs you get with using that sort of approach, it's also super time consuming, and when you have a lot of SDKs (we have 6 generated SDKs), in my experience it needs someone devoted to managing the process, staying up with template changes etc.
Excited to see more SDK languages come to Stainless!
[1] https://www.mux.com/blog/an-adventure-in-openapi-v3-api-code...
[2] https://github.com/OpenAPITools/openapi-generator
-
FastAPI Got Me an OpenAPI Spec Really... Fast
As a result, the following specification can be used to generate clients in a number of different languages via OpenAPI Generator.
-
Show HN: Manage on-prem servers from my smartphone
Of course you can compile the server from source if you have Go and the OpenAPI generator JAR (https://github.com/OpenAPITools/openapi-generator?tab=readme...)
Follow these steps : https://github.com/c100k/rebootx-on-prem/blob/master/.github...
And then :
(cd ./impl/http-server-go && GOARCH=amd64 GOOS=openbsd go build -o /app/rebootx-on-prem-http-server-go-openbsd-amd64 -v)
By adapting the arch if needed. Not tested, but it should work.
- OpenAPI Generator v7.3.0 has new generators for Rust, Kotlin, Scala and Java
-
Stop creating HTTP clients manually - Part I
TL;DR: Start generating your HTTP clients and all the DTOs of the requests and responses automatically from your API, using openapi-generator instead of writing your own.
What are some alternatives?
axum - Ergonomic and modular web framework built with Tokio, Tower, and Hyper
NSwag - The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
Rocket - A web framework for Rust.
oapi-codegen - Generate Go client and server boilerplate from OpenAPI 3 specifications
jelly-actix-web-starter - A starter template for actix-web projects that feels very Django-esque. Avoid the boring stuff and move faster.
SvelteKit - web development, streamlined
async-graphql - A GraphQL server library implemented in Rust
smithy - Smithy is a protocol-agnostic interface definition language and set of tools for generating clients, servers, and documentation for any programming language.
okapi - OpenAPI (AKA Swagger) document generation for Rust projects
django-ninja - 💨 Fast, Async-ready, Openapi, type hints based framework for building APIs
actix-web - Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.
autorest - OpenAPI (f.k.a Swagger) Specification code generator. Supports C#, PowerShell, Go, Java, Node.js, TypeScript, Python