Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support OpenApiBuilder flow #146

Open
Averios opened this issue Jan 17, 2023 · 3 comments
Open

Support OpenApiBuilder flow #146

Averios opened this issue Jan 17, 2023 · 3 comments
Labels
enhancement New feature or request scope: runtime

Comments

@Averios
Copy link

Averios commented Jan 17, 2023

The old plugin allows us to define OpenAPI documentation on runtime.
Example:

OpenApiDocumentation getPriceByProductId =
            OpenApiBuilder.document()
                    .queryParam("productId", String.class)
                    .json("200", Price.class);

ApiBuilder.get(
                "/products/{productId}/price",
                OpenApiBuilder.documented(
                        getPriceByProductId, priceByProductIdHandler());

It would be nice to also have this option on Javalin 5.

@dzikoysk
Copy link
Member

dzikoysk commented Jan 17, 2023

This is slightly out of scope at this moment to cover full specification with dedicated builder, because we're focused on compile-time specification. Even tho, it's still possible to use other libraries (e.g. https://github.com/derveloper/kotlin-openapi3-dsl ) and integrate them with our plugins:

.withDefinitionProcessor(content -> { // you can add whatever you want to this document using your favourite json api
content.set("test", new TextNode("Value"));
return content.toPrettyString();
}))

If you don't want use compile-time annotations, you can also replace builder with raw json/yaml specification.

@dzikoysk dzikoysk added the enhancement New feature or request label Jan 17, 2023
@dzikoysk
Copy link
Member

I'll mark it as enhancement request for now - it'll require some work to port current implementation into serializable dto structure, but I guess it could be also a healthy change for current impl.

@Averios
Copy link
Author

Averios commented Jan 17, 2023

Thank you, I'll try to check on how to use DefinitionProcessor for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request scope: runtime
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants