the last two days I had the opportunity to play around with Micronaut.
It looks nice and I like the built in support for OpenAPI (Swagger). I managed to have the OpenAPI documentation in a local Swagger-UI and I was able to create some documentation which is shown in Swagger-UI as expected.
Then I moved to a little real world project which uses Lombok with fluent API which is configured in lombok.config
lombok.accessors.fluent=true
This setting causes Lombok not to create getter/setters, but something like
private String name;
public String name()...
public void name(String name)...
Unfortunately the OpenAPI documentation generation does not work properly in this setup - it is skipped. It seems the getter convention is required.
Is there any Micronaut-Swagger-Extension available which support the lombok fluent accessors?
If there is none, can you please give me any hint which piece of code scans the methods for annotations so I can extend it?
Thank you in advance!
UPDATE 1:
For better problem reproduction I enhanced the Micronaut Java Example: https://github.com/flexguse/micronaut-examples/tree/master/hello-world-java
The README.md contains detailed information, how to configure lombok to get the missing OpenAPI documentation.
No, Afaik there is no Micronaut Swagger extension for Lombok at the moment.
The OpenApiApplicationVisitor.java is responsible for generating OpenAPI documentation. And, if you are planning to work on micronaut-openapi for supporting the Lombok fluent accessors I would be happy to help.
Related
As the krakend.json is not of the type which swagger understands.Following error occurs:
Error: Document must be valid OpenAPI 3.0.0 definition
Is there any alternate way to generate documentation for krakenD
Generating both KrakenD configuration and OpenAPI documentation is possible, but...
You should precisely define your use case:
Do you want to generate krakend.json config from OpenAPI just as no-op proxy? (see an example script)
Are you willing to adopt another (custom) format? (see openapi2krakend)
Do you want to generate OpenAPI documentation from KrakenD config? If so, do you need just a list of endpoints or do you want also to have defined descriptions, examples and types (!) in one file?
You should (at least try to) write the script to generate the configuration by yourself to suit your needs.
Consider a usage of KrakenD Studio that has the OpenAPI generator plugin.
It can look like a good idea, but the devil is in the details and you should analyse your requirements because these two files have totally different purposes. I can only suggest you write such a transformation script (as I did) which should be like "5 minutes of work" and then go to the deep.
Edit: We have selected a subset of KrakendD features and implemented our own configuration generator (from OAS). We use tags with a custom route-to/ prefix for metadata, a definition could look like this:
/coupons/{id}:
get:
tags:
- Coupons
- route-to/path=/coupons/{id}/detail
- route-to/backend=GET|http://coupons.content
- route-to/flags=jwt_validation
There is a mention in the docs of using the logging package to create a proper logger service. Given the features in the logging package it would be nice to be able to get the angular component tree as the logger full name.
I tried to play a bit with the dependency injection system to get the injector tree, so that I could reconstruct the app structure for the loggers. But this proved to be too tricky.
Is there a way to do this, or alternatively, is there a canonical logger service that I could use? It seems to be a pretty basic feature so it must be available somewhere.
I'd look at the logging package for help here.
This is not Angular-specific, but it supports tested loggers.
i'm trying to use swagger-codegen-maven-plugin to generate my interface .
after compiling with the plugin - it generates all the files correctly but for some reason
the interface name is DefaultApi.
i looked for some configuration that i can change the name of the interface that been generated but didnt find the solution for that.
any idea on that??
"DefaultApi" is used when there's no tags specified for the endpoint.
For example, this endpoint will be put in a class named "UserApi" since the tags is set to User.
You will need to update the spec to include proper tags for endpoints to avoid using "DefaultApi"
UPDATE: On May 2018, about 50 top contributors and template creators of Swagger Codegen decided to fork Swagger Codegen to maintain a community-driven version called OpenAPI Generator. Please refer to the Q&A for more information.
We have an growing swagger API/openAPI and for documenting changes we like to document on a path or parameter (and perhaps definition) since which version of the API it is available.
The swagger specification knows the info.version field, but on paths or parameters I could not find something refering to this version.
Perhaps vendor extensions beginning with a x-... like x-since might be helpful. At least validation does not fail using them.
But is there perhaps any existing implementation for this use case?
I'm not aware of any existing attribute in OpenAPI/Swagger 2.0 spec to meet your need so you should go with vendor extensions (x-since, x-created-on, x-created-by, etc)
I am using the Swagger Node project with Express 4 to build my apis. https://github.com/swagger-api/swagger-node
I can make my "swagger api" work, however I could not get expose my apis as JSON to be read by the Swagger-UI(https://github.com/swagger-api/swagger-ui).
How can I achieve it? I know that the previous version I need to use the following method:
swagger.configureSwaggerPaths("", "/api-docs", "");
But with the changes in the project, I dont what to call..
Ty
Maybe look into swagger-tools offered by Apigee-127, i believe this is the best module for node/swagger integration