Show HN: A faster way to prototype your APIs using OpenAPI 3 and Swagger UI

by yehorson 10/23/2020, 10:17 AMwith 41 comments

by hardwaresoftonon 10/23/2020, 12:30 PM

Hey you might want to note a bit more about what exactly this does and how it does it on the README. I went to the page and was thoroughly confused -- does this library:

- Read application code (written in python?) and extract an API specification? Is it flask only?

- Does it update the file on disk repeatedly?

- Does it modify generated application code to add an endpoint for the Swagger UI and host it?

- Are any modifications to the pre-existing applications necessary?

- Does it wrap an existing application?

Good tools also often have a comparison section -- are there other tools in your space that do what you do, but differently?

I'd like to think I'm familiar with the Swagger/Swagger2/OpenAPI3 space, and I'm aware of tools that go spec->code (usually generating clients/servers) and code->spec (whether by comments, annotations, or some other language mechanism), but it's not clear what your tool actually does.

by OJFordon 10/23/2020, 2:01 PM

Shameless plug, I did something similar in Rust (that is, 2017 rust that I haven't gone back to) for my MEng project.

I really wish more APIs/people used OpenAPI, I think/thought it's fantastic, but I haven't really used it since. Docs-only at work, a bit, but it has so much more potential.

--

Main difference in mine is that I used the OpenAPI spec as the starting point though - I wanted to be able to use it as an API-specific HTTP client. From that I inferred type signatures at compile-time in order to enforce correct (per the spec) use of an API, and enforce handling all the (stated) possible error cases. Idea being that if you did the same on the server side, you'd have pretty good guarantees about your communication.

Kept meaning (still mean?) to go back to it, but I haven't yet. It supports the basics, but it's far from battle-tested; I might never get back to working on it, but if it's of interest to anyone for (absolutely non-production) toying around, I'll certainly respond and act on any PRs.

https://github.com/OJFord/tapioca

It seems they're not linked from the readme (probably I was scared to update it post-deadline in case of examiner doubt, and presentation/slide manufacture was post-submission deadline) but there's also slides (linked from the release) that perhaps have a bit more detail on what I was going for from a more technical perspective (though it's been a while):

https://github.com/OJFord/tapioca/releases/download/v0.0.1/s...

by dvlxon 10/23/2020, 1:43 PM

Even easier with FastApi

https://fastapi.tiangolo.com/

Auto generates both interactive SwaggerUI and Redoc pages.

Can turn off before production deployment.

by adentaon 10/23/2020, 12:37 PM

As someone who used openAPI for the first time recently, I don’t understand the benefit.

Im building an integration between two different API’s. I was given the openAPI spec and instructed to find a mock server generator to get a boilerplate app up. I spent like two hours trying to find some sort of generator that provides value. All the generators I tried seemed half baked (I wanted to use rails for this project, because that’s what I am most familiar developing in. I understand rails is a sub optimal choice for this project.)

In the time I wasted trying to find a generator, I could’ve just wrote the code by hand. Once I just started manually writing code, everything started moving much quicker. Even if I had used a generator, I’d still need to manually update things every time the interface changes, yeah? Who is openAPI for?

by BerislavLopacon 10/23/2020, 2:04 PM

Shameless plug: I have been developing Pyotr [0], a helpful async library - based on top of Starlette [1] and httpx [2] - which is using OpenAPI as the specification for routing and validation, both on server and client side.

[0] https://pyotr.readthedocs.io

[1] https://www.starlette.io/

[2] https://www.python-httpx.org/

by carapaceon 10/23/2020, 2:18 PM

I've been out-of-the-loop for a while, what's the state of the art in re: OpenAPI/Swagger?

What I mean is, are people using it in the wild? Are there mature (or at least pretty stable) code generators? Test generators? What's inter-operability like? (Is it easy/possible to generate clients and server stubs in different languages that will work together? Can I write a service, publish my API spec, and expect people to be able to use it to write clients?)

by apocalyptic0n3on 10/23/2020, 5:54 PM

Just a heads up, there are a number of similar/identically named projects:

- https://openapi-generator.tech/

- https://github.com/zijianhuang/openapiclientgen

- https://github.com/deepmap/oapi-codegen

I swear I've come across a few others while looking for the best web visualizer (mostly settled on Redoc), but I'm not finding them on https://openapi.tools/ or http://openapi.toolbox.apievangelist.com, so perhaps they've been abandoned

by Twisellon 10/23/2020, 1:57 PM

As other mentioned this the description is particularly non-user friendly for something that (as far as I understood) is related to a documentation management system.

I'm mostly a backend GUI but still interested in learning more about web API. But the only description sentence is presuming that reader is comfortable with a highly specialized jargon. On the other hand I smell that "any project" is probably far narrower than it sound.

> The goal of this project is to create a generator that conveniently creates API definitions in OpenAPI 3 format and then injects the generated YAML file with Swagger UI to any project.

by codenesiumon 10/23/2020, 2:07 PM

Shameless plug! Generate a .net core skeleton from a OpenAPI spec. It's a work in progress.

https://www.codenesium.com/projects

by tlarkworthyon 10/23/2020, 3:04 PM

I am confused when people try to generate api specs from languages (e.g. typescript to openAPI). The big draw to API specs for me is language independence. By generating from an implementation it's the wrong way round and you lose a degree of freedom IMHO.

by Nijikokunon 10/23/2020, 5:57 PM

Insomnia Designer can help you develop and manage your OpenAPI specs as well :)

https://insomnia.rest/products/designer

by _the_special_on 10/23/2020, 1:05 PM

the README file of this repo does not help me understand what this project is about as someone who has never used OpenAPI (and only faintly used Swagger UI for a short time before).

by kapilvton 10/23/2020, 1:03 PM

went through the code, there's nothing here that i can see. its just a demo pet store app in flask.