Skip to content
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

[BUG] Xml deserializer not generated #11578

Closed
amazoyer opened this issue Feb 11, 2022 · 1 comment · Fixed by #18568
Closed

[BUG] Xml deserializer not generated #11578

amazoyer opened this issue Feb 11, 2022 · 1 comment · Fixed by #18568

Comments

@amazoyer
Copy link

amazoyer commented Feb 11, 2022

Hello,

When using a client with openapi version 5.4.0 and the java generator, I get the following exception:
com.test.nifi.invoker.ApiException: Deserialization for content type 'application/xml' not supported for type 'com.test.nifi.api.ProcessGroupsApi$31@36d582cb'

When I did into the generated code, I can see that the xml deserialization is not implemented:

public <T> T deserialize(HttpResponse response, TypeReference<T> valueType) throws ApiException, IOException { if (valueType == null) { return null; } HttpEntity entity = response.getEntity(); Type valueRawType = valueType.getType(); if (valueRawType.equals(byte[].class)) { return (T) EntityUtils.toByteArray(entity); } else if (valueRawType.equals(File.class)) { return (T) downloadFileFromResponse(response); } String mimeType = getResponseMimeType(response); if (mimeType == null || isJsonMime(mimeType)) { // Assume json if no mime type return objectMapper.readValue(entity.getContent(), valueType); } else { throw new ApiException( "Deserialization for content type '" + mimeType + "' not supported for type '" + valueType + "'", response.getStatusLine().getStatusCode(), responseHeaders, EntityUtils.toString(entity) ); } }

Even though I think I correctly activated the xml generation option as we can see in the maven debug log during generation:
[DEBUG] (f) skipValidateSpec = true [DEBUG] (f) typeMappings = [] [DEBUG] (f) verbose = false [DEBUG] (f) withXml = true [DEBUG] -- end configuration --
Any idea what can go wrong?

Thank you,

Aurelien

@Philzen
Copy link
Contributor

Philzen commented May 26, 2024

@amazoyer have you generated using withXml=true set as additional-properties, not global-property?

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