OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.67k stars 6.54k forks source link

[BUG][java] CustomTypeAdapterFactory incorrectly assumes non-primitives are json objects #14404

Closed ashatch closed 8 months ago

ashatch commented 1 year ago

Bug Report Checklist

Description

pojo.moustache's CustomTypeAdapterFactory.create populates properties by testing for e.g. primitive types for values. It's else block makes an assumption that if it isn't a primitive type, it must be an object:

gson.toJsonTree(entry.getValue()).getAsJsonObject()

This fails when considering arrays.

openapi-generator version

master

Suggest a fix

I'll raise a PR.

wing328 commented 1 year ago

can you please share a spec to reproduce the issue?

wing328 commented 8 months ago

closed via https://github.com/OpenAPITools/openapi-generator/pull/17812