Skip to content

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

@ashatch

Description

@ashatch

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

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions