We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
openapi-generator/modules/openapi-generator/src/main/resources/apex/OAS.cls
If you send a response that contains anything in addition to "application/json" nothing is returned.
Set the toReturnValue to validate for more than just application/json e.g. UTF-8 within the Content Type.
@testvisible protected virtual Object toReturnValue(String body, Type returnType, String contentType) { Original ---> if (contentType == 'application/json') { Desired ---> if (contentType.contains('application/json')) { Object o = returnType.newInstance(); if (o instanceof MappedProperties) { Map<String, String> propertyMappings = ((MappedProperties) o).getPropertyMappings(); for (String baseName : propertyMappings.keySet()) { body = body.replaceAll('"' + baseName + '"\s*:', '"' + propertyMappings.get(baseName) + '":'); } } JsonParser parser = Json.createParser(body); parser.nextToken(); return parser.readValueAs(returnType); } return body; }
The text was updated successfully, but these errors were encountered:
Your suggestion sounds good to me May I know if you've time to submit a PR with the suggested change?
Sorry, something went wrong.
Sure I can submit
Successfully merging a pull request may close this issue.
openapi-generator/modules/openapi-generator/src/main/resources/apex/OAS.cls
If you send a response that contains anything in addition to "application/json" nothing is returned.
Set the toReturnValue to validate for more than just application/json e.g. UTF-8 within the Content Type.
@testvisible
protected virtual Object toReturnValue(String body, Type returnType, String contentType) {
Original ---> if (contentType == 'application/json') {
Desired ---> if (contentType.contains('application/json')) {
Object o = returnType.newInstance();
if (o instanceof MappedProperties) {
Map<String, String> propertyMappings = ((MappedProperties) o).getPropertyMappings();
for (String baseName : propertyMappings.keySet()) {
body = body.replaceAll('"' + baseName + '"\s*:',
'"' + propertyMappings.get(baseName) + '":');
}
}
JsonParser parser = Json.createParser(body);
parser.nextToken();
return parser.readValueAs(returnType);
}
return body;
}
The text was updated successfully, but these errors were encountered: