[BUG] Failed at unknown property
Bug Report Checklist
- [ ] Have you provided a full/minimal spec to reproduce the issue?
- [ ] Have you validated the input using an OpenAPI validator (example)?
- [ ] Have you tested with the latest master to confirm the issue still exists?
- [ ] Have you searched for related issues/PRs?
- [ ] What's the actual output vs expected output?
- [ ] [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)
openapi-generator version
7.2.0
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix
I got the same problem. I think it like a question of strict mode, I tried the following parameters, but they didn't work
--strict-spec false \
--skip-validate-spec \
Same issue here
I got the same problem. I think it like a question of strict mode, I tried the following parameters, but they didn't work
--strict-spec false \ --skip-validate-spec \
The Option is useful for me disallowAdditionalPropertiesIfNotPresent