OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
[ ] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I am using openapi-generator-maven-plugin to generate the client jar of my application A. The client jar is introduced as a dependency of application B. Application B is calling the API of A at runtime time.
At some point, a new property onlineState was added to the DeviceDto, which caused application B to fail when trying to get the device.
Here is the stack.
Caused by: java.lang.IllegalArgumentException: The field `onlineState` in the JSON string is not defined in the `DeviceDto` properties. JSON: {\"serialNumber\":\"002\",\"onlineState\":\"OFFLINE\"}
at package.name.DeviceDto.validateJsonElement(DeviceDto.java:148)
at package.name.DeviceDto$CustomTypeAdapterFactory$1.read(DeviceDto.java:178)
at package.name.DeviceDto$CustomTypeAdapterFactory$1.read(DeviceDto.java:168)
at com.google.gson.TypeAdapter$1.read(TypeAdapter.java:199)
at com.google.gson.Gson.fromJson(Gson.java:932)
at com.google.gson.Gson.fromJson(Gson.java:897)
at com.google.gson.Gson.fromJson(Gson.java:846)
at package.name.client.api.JSON.deserialize(JSON.java:156)
at package.name.client.api.ApiClient.deserialize(ApiClient.java:895)
at package.name.client.api.ApiClient.handleResponse(ApiClient.java:1105)
at package.name.client.api.ApiClient.execute(ApiClient.java:1029)
at package.name.client.api.DeviceApi.getDeviceBySerialNumberWithHttpInfo(DeviceApi.java:693)
at package.name.client.api.DeviceApi.getDeviceBySerialNumber(DeviceApi.java:673)
Bug Report Checklist
Description
I am using openapi-generator-maven-plugin to generate the client jar of my application A. The client jar is introduced as a dependency of application B. Application B is calling the API of A at runtime time. At some point, a new property
onlineState
was added to the DeviceDto, which caused application B to fail when trying to get the device.Here is the stack.
openapi-generator version
7.2.0
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix