Skip to content

Not able to build generated java implementation for Json spec file #6267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 of 6 tasks
ngp-star opened this issue May 12, 2020 · 1 comment
Open
3 of 6 tasks

Not able to build generated java implementation for Json spec file #6267

ngp-star opened this issue May 12, 2020 · 1 comment

Comments

@ngp-star
Copy link
Contributor

ngp-star commented May 12, 2020

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description
openapi-generator version

4.3.0

OpenAPI declaration file content or url

below is the code spec of the json file
below file content is just content of model.

PublicKeyDto: {
description: "Public Key",
properties: {
value: {
allowEmptyValue: false,
type: "string",
description: "value"
},
issuer: {
allowEmptyValue: false,
type: "string",
description: "issuer"
},
alg: {
allowEmptyValue: false,
type: "string",
description: "alg"
},
keys: {
items: {
$ref: "#/definitions/MapOfstringAndobject"
},
allowEmptyValue: false,
type: "array",
description: "keys"
}
},
title: "PublicKeyDto",
type: "object"
}
{
title: "MapOfstringAndobject",
additionalProperties: {
type: "object"
},
type: "object"
}

Command line used for generation

openapi-generator generate -i swagger.json -g java -o csp-java-bindings --package-name com.org.csp.openapi_client

Steps to reproduce

after generation try to build the implementation using mvn clean package .
below is the error trace.
Compilation failure
[ERROR] /dbc/sc-dbc2115/ngp/csp-python-bindings/src/main/java/org/openapitools/client/model/PublicKeyDto.java:[130,18] error: incompatible types: ArrayList<Map> cannot be converted to List<Map<String,Object>>
in the implementation of PublicKeyDto.java following assignment is happening which is not correct according to java syntax.

public PublicKeyDto addKeysItem(Map<String, Object> keysItem) {
if (this.keys == null) {
this.keys = new ArrayList<Map>();//in this line error is coming.
}
this.keys.add(keysItem);
return this;
}
this.keys is declared as private List<Map<String, Object>> keys = null;

Related issues/PRs
Suggest a fix
@auto-labeler
Copy link

auto-labeler bot commented May 12, 2020

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant