Live data from Hacker News

OpenAPI Generator allows generation of API client libraries from OpenAPI Specs

github.com

51–60 of 73 posts

Re: OpenAPI Generator allows generation of API client libraries from OpenAPI Specs

#51

Also check out Smithy from AWS ( https://github.com/awslabs/smithy ), the code it generates is much better. It's influenced by the new AWS SDKs so it has generator support for Rust.

Does smithy support OpenAPI? Doesn't seem like it does (found a reference to smithy -> openAPI support, but not the reverse).

Re: OpenAPI Generator allows generation of API client libraries from OpenAPI Specs

#52

I tried using it as a Go code generator (I only needed structs and marshaler / unmarshaler helpers), but it ended up being way too difficult to use and I couldn't get it to work properly. After a bit of searching, I bumped into Deepmap's implementation https://github.com/deepmap/oapi-codegen which works great. They even added support for oneOf, anyOf and allOf which makes things a lot easier.

That's awesome, thanks for sharing!

Would love to know if anyone else has any language specific SDK generators they'd recommend, similar to the Deepmap implementation, but for another language (ruby, python, c#, java, etc).

Re: OpenAPI Generator allows generation of API client libraries from OpenAPI Specs

#53

I’ve been trying to use this to generate sane, idiomatic Kotlin models, and am so far a little frustrated by the choices the generator makes - especially with regards to how to represent `anyOf` And `allOf` constructs. Has anyone had success with generated Kotlin? I’m also curious if there are other Kotlin generators out there.

It's been a pain for us too. Personally, I don't really see the point of type checked request/response models. Theoretically, I can see how it's nice but ultimately the source of truth are the domain models on either side. If you do something wrong you'll either see a 400 or be unable to build models from the response.

And since the compiler can't really type check across the API boundary you still need to account for unexpected values. The difference is that the failure happens in ugly auto generated code instead of within your code where it is more easily handled.

Re: OpenAPI Generator allows generation of API client libraries from OpenAPI Specs

#54
OAPIv3 (fully spec'd/schema'd REST+JSON APIs) is nice, and the generators are important, yet as many point out "not always that great".

There's an alternative technology: GraphQL, which has generators too!

Here a PoC of mine demo'ing an architecture in which the backend is very low code (mostly due to Hasura), and most of the app's code is in the frontend: an Elm app with generated type-safe Elm-bindings to the GraphQL backend.

https://github.com/cies/low-code-backend-dockered

Re: OpenAPI Generator allows generation of API client libraries from OpenAPI Specs

#55
post #41

I was very excited about this project when I first encountered it as it seemed to be the best centralized community-driven way to generate code for multiple languages and supporting v3. The more time I spent with it the more disappointed I became. The reason why you are forced to write Java and write your own generator alongside the rest of the project is unclear to me. Extending the mustache templates is a pain (and…

Isn't this the case with all Open Source, that if one really wants to extend something, one must first get into the same mindset as the original designer and understand "their way" of doing it?

Re: OpenAPI Generator allows generation of API client libraries from OpenAPI Specs

#56

I tried using it as a Go code generator (I only needed structs and marshaler / unmarshaler helpers), but it ended up being way too difficult to use and I couldn't get it to work properly. After a bit of searching, I bumped into Deepmap's implementation https://github.com/deepmap/oapi-codegen which works great. They even added support for oneOf, anyOf and allOf which makes things a lot easier.

One of the maintainers here, thanks for sharing and that it's been great for you

Re: OpenAPI Generator allows generation of API client libraries from OpenAPI Specs

#57

I tried using it as a Go code generator (I only needed structs and marshaler / unmarshaler helpers), but it ended up being way too difficult to use and I couldn't get it to work properly. After a bit of searching, I bumped into Deepmap's implementation https://github.com/deepmap/oapi-codegen which works great. They even added support for oneOf, anyOf and allOf which makes things a lot easier.

One of the maintainers here, thanks for sharing and that it's been great for you

Happy to help and thank you for the great work! :)

Re: OpenAPI Generator allows generation of API client libraries from OpenAPI Specs

#59
post #52

I tried using it as a Go code generator (I only needed structs and marshaler / unmarshaler helpers), but it ended up being way too difficult to use and I couldn't get it to work properly. After a bit of searching, I bumped into Deepmap's implementation https://github.com/deepmap/oapi-codegen which works great. They even added support for oneOf, anyOf and allOf which makes things a lot easier.

That's awesome, thanks for sharing! Would love to know if anyone else has any language specific SDK generators they'd recommend, similar to the Deepmap implementation, but for another language (ruby, python, c#, java, etc).

[deleted]
Post reply on HN