Skip to content

[BUG] Xml deserializer not generated #11578

@amazoyer

Description

@amazoyer

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

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