Skip to content

[JAVA][native] import the auto generated supporting JSON class only when discriminator is needed#8554

Merged
wing328 merged 20 commits intoOpenAPITools:masterfrom
MosheElisha:master
Feb 12, 2021
Merged

[JAVA][native] import the auto generated supporting JSON class only when discriminator is needed#8554
wing328 merged 20 commits intoOpenAPITools:masterfrom
MosheElisha:master

Conversation

@MosheElisha
Copy link
Contributor

@MosheElisha MosheElisha commented Jan 27, 2021

Import the auto generated supporting JSON class only when generateSupportingFiles is true.

Closes #8027

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master, 5.1.x, 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@MosheElisha
Copy link
Contributor Author

MosheElisha commented Jan 28, 2021

@bgong-mdsol @bbdouglas @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger @karismann @Zomzog @lwlee2608 @nmuesch @spacether @jimschubert mentioning the technical committee as requested and the last modifier of the template file. Please review. Thanks in advance.

@MosheElisha MosheElisha changed the title Fix #8027 - don't import JSON class if generateSupportingFiles is false [JAVA][native] - Fix #8027 - don't import JSON class if generateSupportingFiles is false Feb 1, 2021
@Zomzog
Copy link
Contributor

Zomzog commented Feb 2, 2021

The import looks unused for the simple models so it may be just removed.
But not il all_of where it is used. So even with generateSupportingFiles=true it must be added.

@MosheElisha
Copy link
Contributor Author

Thanks, @Zomzog . If generateSupportingFiles=false, we can surely remove the import otherwise it won't compile, right?

If so, isn't removing the import ...JSON when generateSupportingFiles=false is simpler?

If JSON is used and generateSupportingFiles=false you will have a compilation issue and you will understand you need to change generateSupportingFiles to true.

@wing328
Copy link
Member

wing328 commented Feb 3, 2021

cc @OpenAPITools/generator-core-team

@Zomzog
Copy link
Contributor

Zomzog commented Feb 3, 2021

Thanks, @Zomzog . If generateSupportingFiles=false, we can surely remove the import otherwise it won't compile, right?

If so, isn't removing the import ...JSON when generateSupportingFiles=false is simpler?

If JSON is used and generateSupportingFiles=false you will have a compilation issue and you will understand you need to change generateSupportingFiles to true.

What I think is you can just remove it from the model.mustache without any condition.
But in other model templates like the anyof the import is used so you must keep it. If the user make the choice of skipping generateSupportingFiles he must provide JSON class in another way.

@MosheElisha
Copy link
Contributor Author

@Zomzog OK. Thanks for the review! I'll remove the import ...JSON from model.mustache all together.

…ss only when generateSupportingFiles is true
@MosheElisha
Copy link
Contributor Author

@Zomzog continuous-integration/drone/pr job failed. Seems JSON is used in model classes sometimes.

/drone/src/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Dog.java:[118,3] cannot find symbol
[ERROR]   symbol:   variable JSON
[ERROR]   location: class org.openapitools.client.model.Dog

For example, openapi-generator/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Dog.java:

public class Dog extends Animal {
...
static {
  // Initialize and register the discriminator mappings.
  Map<String, Class<?>> mappings = new HashMap<String, Class<?>>();
  mappings.put("Dog", Dog.class);
  JSON.registerDiscriminator(Dog.class, "className", mappings);
}
}

@Zomzog
Copy link
Contributor

Zomzog commented Feb 4, 2021

Ok, in this case maybe the import condition may be done like

{{#model}}
{{#discriminator}}
import {{invokerPackage}}.JSON;
{{/discriminator}}

I'm not sure it's really useful to try to remove this import because most of the supporting files must be generated or provided in one way or another. Does this one really create an issue in particular cases?

@MosheElisha
Copy link
Contributor Author

MosheElisha commented Feb 4, 2021

Thanks, @Zomzog . That is a good observation. There is a generateSupportingFiles and you assume that it should be possible to make it false but as it turns out it the "supporting files" are mandatory in this case.

I'm guessing one approach is to make the supporting files list as minimal as possible. For example:

<supportingFilesToGenerate>JSON.java,RFC3339DateFormat.java</supportingFilesToGenerate>

In my case, I don't want and don't need the supporting files. I just want to generate model classes as POJOs.
The problem I have is that these two supporting files also require me to add dependencies on jackson-datatype-jsr310, jackson-databind-nullable and jakarta.ws.rs-api.

In my case, my auto generated model classes are not using the JSON class at all so I don't need the supporting files and all the dependencies. I want to be able to share and use the "model classes" in other use cases (e.g., sending them in a queue) and I want the receiving end to be able to depend on the "model classes" jar without too many unnecessary dependencies.

I will try your suggestion with the discriminator flag.
I feel that this is a good solution. It will help my issue and it is anyway good practice to add the import only when it is needed.

@MosheElisha
Copy link
Contributor Author

@wing328 @Zomzog I believe Shippable failure is unrelated to my changes can you please verify/rerun and review if PR is OK?

I tested discriminator flag in the pojo.mustache as it is undefined in the model.mustache.

Thanks.

@MosheElisha MosheElisha changed the title [JAVA][native] - Fix #8027 - don't import JSON class if generateSupportingFiles is false [JAVA][native] - Fix #8027 - import the auto generated supporting JSON class only when discriminator is needed Feb 8, 2021
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. Done.

@wing328
Copy link
Member

wing328 commented Feb 12, 2021

Tested locally and no issue found.

I found some warnings though:

[WARNING] Javadoc Warnings
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/JSON.java:63: warning: no @return
[WARNING] public static Class<?> getClassForElement(JsonNode node, Class<?> modelClass) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/JSON.java:168: warning: no @param for visitedClasses
[WARNING] public static boolean isInstanceOf(Class<?> modelClass, Object inst, Set<Class<?>> visitedClasses) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/JSON.java:168: warning: no @return
[WARNING] public static boolean isInstanceOf(Class<?> modelClass, Object inst, Set<Class<?>> visitedClasses) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java:84: warning: no @return
[WARNING] public CompletableFuture<Void> createXmlItem(XmlItem xmlItem) throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java:519: warning: no @return
[WARNING] public CompletableFuture<Void> testBodyWithFileSchema(FileSchemaTestClass body) throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java:599: warning: no @return
[WARNING] public CompletableFuture<Void> testBodyWithQueryParams(String query, User body) throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java:798: warning: no @return
[WARNING] public CompletableFuture<Void> testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java:903: warning: no @return
[WARNING] public CompletableFuture<Void> testEnumParameters(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java:997: warning: no @return
[WARNING] public CompletableFuture<Void> testGroupParameters(APItestGroupParametersRequest apiRequest) throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java:1035: warning: no @return
[WARNING] public CompletableFuture<Void> testGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java:1216: warning: no @return
[WARNING] public CompletableFuture<Void> testInlineAdditionalProperties(Map<String, String> param) throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java:1296: warning: no @return
[WARNING] public CompletableFuture<Void> testJsonFormData(String param, String param2) throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java:1378: warning: no @return
[WARNING] public CompletableFuture<Void> testQueryParameterCollectionFormat(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context) throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java:79: warning: no @return
[WARNING] public CompletableFuture<Void> addPet(Pet body) throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java:159: warning: no @return
[WARNING] public CompletableFuture<Void> deletePet(Long petId, String apiKey) throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java:521: warning: no @return
[WARNING] public CompletableFuture<Void> updatePet(Pet body) throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/PetApi.java:602: warning: no @return
[WARNING] public CompletableFuture<Void> updatePetWithForm(Long petId, String name, String status) throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/StoreApi.java:76: warning: no @return
[WARNING] public CompletableFuture<Void> deleteOrder(String orderId) throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java:76: warning: no @return
[WARNING] public CompletableFuture<Void> createUser(User body) throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java:155: warning: no @return
[WARNING] public CompletableFuture<Void> createUsersWithArrayInput(List<User> body) throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java:234: warning: no @return
[WARNING] public CompletableFuture<Void> createUsersWithListInput(List<User> body) throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java:313: warning: no @return
[WARNING] public CompletableFuture<Void> deleteUser(String username) throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java:577: warning: no @return
[WARNING] public CompletableFuture<Void> logoutUser() throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/UserApi.java:646: warning: no @return
[WARNING] public CompletableFuture<Void> updateUser(String username, User body) throws ApiException {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java:83: warning: no @param for key
[WARNING] public AdditionalPropertiesAnyType putAdditionalProperty(String key, Object value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java:83: warning: no @param for value
[WARNING] public AdditionalPropertiesAnyType putAdditionalProperty(String key, Object value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java:83: warning: no @return
[WARNING] public AdditionalPropertiesAnyType putAdditionalProperty(String key, Object value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java:95: warning: no @return
[WARNING] public Map<String, Object> getAdditionalProperties() {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java:102: warning: no @param for key
[WARNING] public Object getAdditionalProperty(String key) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java:102: warning: no @return
[WARNING] public Object getAdditionalProperty(String key) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java:84: warning: no @param for key
[WARNING] public AdditionalPropertiesArray putAdditionalProperty(String key, List value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java:84: warning: no @param for value
[WARNING] public AdditionalPropertiesArray putAdditionalProperty(String key, List value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java:84: warning: no @return
[WARNING] public AdditionalPropertiesArray putAdditionalProperty(String key, List value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java:96: warning: no @return
[WARNING] public Map<String, List> getAdditionalProperties() {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java:103: warning: no @param for key
[WARNING] public List getAdditionalProperty(String key) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java:103: warning: no @return
[WARNING] public List getAdditionalProperty(String key) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java:83: warning: no @param for key
[WARNING] public AdditionalPropertiesBoolean putAdditionalProperty(String key, Boolean value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java:83: warning: no @param for value
[WARNING] public AdditionalPropertiesBoolean putAdditionalProperty(String key, Boolean value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java:83: warning: no @return
[WARNING] public AdditionalPropertiesBoolean putAdditionalProperty(String key, Boolean value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java:95: warning: no @return
[WARNING] public Map<String, Boolean> getAdditionalProperties() {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java:102: warning: no @param for key
[WARNING] public Boolean getAdditionalProperty(String key) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java:102: warning: no @return
[WARNING] public Boolean getAdditionalProperty(String key) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java:83: warning: no @param for key
[WARNING] public AdditionalPropertiesInteger putAdditionalProperty(String key, Integer value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java:83: warning: no @param for value
[WARNING] public AdditionalPropertiesInteger putAdditionalProperty(String key, Integer value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java:83: warning: no @return
[WARNING] public AdditionalPropertiesInteger putAdditionalProperty(String key, Integer value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java:95: warning: no @return
[WARNING] public Map<String, Integer> getAdditionalProperties() {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java:102: warning: no @param for key
[WARNING] public Integer getAdditionalProperty(String key) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java:102: warning: no @return
[WARNING] public Integer getAdditionalProperty(String key) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java:84: warning: no @param for key
[WARNING] public AdditionalPropertiesNumber putAdditionalProperty(String key, BigDecimal value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java:84: warning: no @param for value
[WARNING] public AdditionalPropertiesNumber putAdditionalProperty(String key, BigDecimal value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java:84: warning: no @return
[WARNING] public AdditionalPropertiesNumber putAdditionalProperty(String key, BigDecimal value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java:96: warning: no @return
[WARNING] public Map<String, BigDecimal> getAdditionalProperties() {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java:103: warning: no @param for key
[WARNING] public BigDecimal getAdditionalProperty(String key) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java:103: warning: no @return
[WARNING] public BigDecimal getAdditionalProperty(String key) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java:83: warning: no @param for key
[WARNING] public AdditionalPropertiesObject putAdditionalProperty(String key, Map value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java:83: warning: no @param for value
[WARNING] public AdditionalPropertiesObject putAdditionalProperty(String key, Map value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java:83: warning: no @return
[WARNING] public AdditionalPropertiesObject putAdditionalProperty(String key, Map value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java:95: warning: no @return
[WARNING] public Map<String, Map> getAdditionalProperties() {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java:102: warning: no @param for key
[WARNING] public Map getAdditionalProperty(String key) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java:102: warning: no @return
[WARNING] public Map getAdditionalProperty(String key) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java:83: warning: no @param for key
[WARNING] public AdditionalPropertiesString putAdditionalProperty(String key, String value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java:83: warning: no @param for value
[WARNING] public AdditionalPropertiesString putAdditionalProperty(String key, String value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java:83: warning: no @return
[WARNING] public AdditionalPropertiesString putAdditionalProperty(String key, String value) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java:95: warning: no @return
[WARNING] public Map<String, String> getAdditionalProperties() {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java:102: warning: no @param for key
[WARNING] public String getAdditionalProperty(String key) {
[WARNING] ^
[WARNING] /private/var/tmp/openapi-generator/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java:102: warning: no @return
[WARNING] public String getAdditionalProperty(String key) {
[WARNING] ^

Will open an issue to track to see if anyone from the community can help fix these warnings.

@wing328 wing328 merged commit 90e8dcf into OpenAPITools:master Feb 12, 2021
@wing328 wing328 changed the title [JAVA][native] - Fix #8027 - import the auto generated supporting JSON class only when discriminator is needed [JAVA][native] - import the auto generated supporting JSON class only when discriminator is needed Feb 12, 2021
@wing328 wing328 changed the title [JAVA][native] - import the auto generated supporting JSON class only when discriminator is needed [JAVA][native] import the auto generated supporting JSON class only when discriminator is needed Feb 12, 2021
@MosheElisha
Copy link
Contributor Author

Thank you @wing328 and @Zomzog for reviewing!

@wing328
Copy link
Member

wing328 commented Mar 22, 2021

@MosheElisha thanks for the PR, which has been included in the v5.1.0 release: https://twitter.com/oas_generator/status/1373636654024380423

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][JAVA][native] Generated model java files contain import for non-existent invoker JSON class (supporting files were not generated)

3 participants

Comments