4.3.1
https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/petstore.yaml
I tried to generate Java client side code using microprofile library, but when I generate with that library, generated code has injected Licensed under the Apache License, Version 2.0 (the "License");.
If my understanding is correct, generated code is not under the license matters. https://github.com/OpenAPITools/openapi-generator#34---license-information-on-generated-code
And actually if I changed that library to resteasy or others, these Apache License disclaimer is not injected.
Library options are listed on here's library row: https://openapi-generator.tech/docs/generators/java/
Language: OpenJDK 11.0.7
Build Tool: Gradle 6.4.1
Generator: OpenAPI Generator Gradle Plugin 4.3.1
portion of build.gradle:
plugins {
id 'java'
id 'io.quarkus'
id "org.openapi.generator" version "4.3.1"
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
implementation 'io.swagger:swagger-annotations:1.6.0'
implementation 'org.openapitools:jackson-databind-nullable:0.2.1'
}
group 'xxxx.xxxx.xxxx'
version '1.0.0-SNAPSHOT'
compileJava {
options.encoding = 'UTF-8'
options.compilerArgs << '-parameters'
}
compileTestJava {
options.encoding = 'UTF-8'
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
test {
systemProperty "java.util.logging.manager", "org.jboss.logmanager.LogManager"
}
sourceSets.main.java.srcDir "${rootDir}/src/gen/java"
task testSpecOpenApiGenerate(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
generatorName = 'java'
configFile = "${rootDir}/src/main/resources/external/openapi-config.json"
inputSpec = "${rootDir}/src/main/resources/external/petstore.yaml"
outputDir = "${rootDir}/src/gen"
}
portion of openapi-config.json:
{
"apiPackage": "xxxx.xxxx.xxxx.external.infrastructure.xxxx.resources",
"dateLibrary": "java8",
"generatePom": false,
"library": "microprofile",
"modelPackage": "xxxx.xxxx.xxxx.external.infrastructure.xxxx.model",
"openApiNullable": true,
"packagesName": "xxxx.xxxx.xxxx",
"sourceFolder": "java"
}
./gradlew testSpecOpenApiGenerateCheck your $projectDir/src/gen/java/xxxx/xxxx/xxxx/external/xxxx/model/Pet.java
if you specify the library option as microprofile, it will contain like this:
/**
* Swagger Petstore
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
if you specify the library option as resteasy, it will contain like this:
/**
* Swagger Petstore
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Also I've checked the other generated code like typescript-angular and jaxrs-spec with quarkus library, but there are much similar header with java with resteasy library.
So, I thought this implementation is not intended.(= to be fixed)
N/A
I know we need to check the case of microprofile, but I'm not sure where it is.
@tkhm thanks for reporting the issue. I've filed https://github.com/OpenAPITools/openapi-generator/pull/7550 to fix it.
PR merged. Please pull the latest master to give it a try.
Most helpful comment
@tkhm thanks for reporting the issue. I've filed https://github.com/OpenAPITools/openapi-generator/pull/7550 to fix it.