Closed franck-malka closed 1 year ago
Yup, these properties are configured in plugin configuration:
Then it's not working.
In my code i set
OpenApiPluginConfiguration openApiConfiguration = new OpenApiPluginConfiguration()
.withDocumentationPath("/swagger")
.withDefinitionConfiguration((version, definition) -> definition
.withOpenApiInfo((openApiInfo) -> {
openApiInfo.setTitle("CAPIF Core Function");
openApiInfo.setVersion("1.1.5");
openApiInfo.setDescription("3GPP TS 29.222 V18.0.0 Common API Framework for 3GPP Northbound APIs");
OpenApiContact contact = new OpenApiContact();
contact.setName("Slicce");
contact.setEmail("support@slicce.co");
contact.setUrl("https://www.slicce.co/api-terms-of-service");
openApiInfo.setContact(contact);
}));
config.plugins.register(new OpenApiPlugin(openApiConfiguration));
and the json generated is
{ "openapi": "3.0.3", "info": { "title": "", "version": "" }, "paths": { "/api-invovation-logs/v1/{aefId}/logs": { "post": {
I mean the json generated at compile time in target/classes/openapi-plugin/openapi-default.json
Plugin configuration only applies changes to the loaded scheme, so it should be available at "http://localhost/openapi". Currently, there's no option to provide this value at compile time (maybe with Groovy script). Do you consume your openapi schemes at compile time? (with e.g. Gradle build)
Yes, it is available at http://localhost/openapi But,
I have several projects exposing APIs and one consuming all the APIs. And i want the consuming API project to automatically load the updated swagger json of the exposing projects at compile time And when i use tthe openapi-annotation-processor output, it misses the title, so all the APIs have no name
I think we could inject these values though annotation processor flags that can be defined in ap/kapt task configuration in Maven/Gradle. Do you think such solution would work for your use-case?
It would mean we need to insert the values in the pom file, right? It's good enough for me but it's not cool to set these values twice.
Once you set it in pom.xml, then you don't have to do that in plugin configuration. Alright I'll try to take a look at it in the evening/tomorrow.
You should be able to inject these values through these 2 flags:
-Aopenapi.info.title=App
-Aopenapi.info.version=1.0.0
In pom.xml:
<configuration>
<annotationProcessorPaths>
[...]
</annotationProcessorPaths>
<compilerArgs>
<compilerArg>-Aopenapi.info.title=App</compilerArg>
</compilerArgs>
</configuration>
with what version this should work? it doesn't seems to work with version 5.4.2
neither with 5.6.2
Hi
I noticed that the openapi-annotation-processor generates a swagger json with no doc info
{ "openapi": "3.0.3", "info": { "title": "", "version": "" }, "paths": { "/api-invovation-logs/v1/{aefId}/logs": { "post": {
is there a way to add at least doc title and doc version using the plugin or an annotation in the code?