-
Bug
-
Resolution: Done
-
Undefined
-
None
-
None
-
None
-
False
-
-
False
-
-
The plugin springdoc-openapi-maven-plugin generate `openapi.json` reading Java classes annotated with `@RequestMapping`.
At the moment, it doesn't generate model class fields annotated with `@JsonInclude(JsonInclude.Include.NON_EMPTY`.
This lead to generating SDK model classes with missing parameters.
For example the `WorkRequestDTO`generated class doesn't have the field `works` that is available in WorkRequestDTO
Integration tests fail if a field is missing. For example:
```
INFO com.redhat.parodos.flows.utils.IntegrationTestUtils - onFailure Message: java.lang.IllegalArgumentException: The field `works` in the JSON string is not defined in the `WorkStatusResponseDTO` properties. JSON: {"name":"subWorkFlowThree","type":"WORKFLOW","status":"IN_PROGRESS","works":[
,{"name":"subWorkFlowTwo","type":"WORKFLOW","status":"IN_PROGRESS","works":[{"name":"subWorkFlowOne","type":"WORKFLOW","status":"COMPLETED","works":[
{"name":"adGroupsWorkFlowTask","type":"TASK","status":"COMPLETED"},
{"name":"splunkMonitoringWorkFlowTask","type":"TASK","status":"COMPLETED"}]},
{"name":"namespaceWorkFlowTask","type":"TASK","status":"IN_PROGRESS"}]}]}
```
Some debug info
- if you substitute `@JsonInclude(JsonInclude.Include.NON_EMPTY` with `@JsonInclude(JsonInclude.Include.NON_NULL` and execute `mvn clean package`, then the `works` field will appear both in `WorkRequestDTO`generated class and in the `openapi.json` file.
- Updrading jackson version to latest, improve the `openapi.json` but doesn't solve the issue.
- add in `application.yml` the `spring.jackson.serialization-inclusion=non_empty` seems to not be effective (TO DOUBLE CHECK)
There are several classes that use the `NON_EMPTY` annotation, here the list:
```
workflow-service/src/main/java/com/redhat/parodos/project/dto/ProjectResponseDTO.java
workflow-service/src/main/java/com/redhat/parodos/workflow/definition/dto/WorkDefinitionResponseDTO.java
workflow-service/src/main/java/com/redhat/parodos/workflow/definition/dto/WorkDefinitionResponseDTO.java
workflow-service/src/main/java/com/redhat/parodos/workflow/definition/dto/WorkFlowDefinitionResponseDTO.java
workflow-service/src/main/java/com/redhat/parodos/workflow/definition/dto/WorkFlowDefinitionResponseDTO.java
workflow-service/src/main/java/com/redhat/parodos/workflow/definition/dto/WorkFlowDefinitionResponseDTO.java
workflow-service/src/main/java/com/redhat/parodos/workflow/definition/dto/WorkParameterValueRequestDTO.java
workflow-service/src/main/java/com/redhat/parodos/workflow/execution/dto/WorkFlowContextResponseDTO.java
workflow-service/src/main/java/com/redhat/parodos/workflow/execution/dto/WorkFlowOptionsResponseDTO.java
workflow-service/src/main/java/com/redhat/parodos/workflow/execution/dto/WorkFlowResponseDTO.java
workflow-service/src/main/java/com/redhat/parodos/workflow/execution/dto/WorkFlowResponseDTO.java
workflow-service/src/main/java/com/redhat/parodos/workflow/execution/dto/WorkFlowStatusResponseDTO.java
workflow-service/src/main/java/com/redhat/parodos/workflow/execution/dto/WorkStatusResponseDTO.java
```