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

decoded schema name on request body to fix issue. #665

Merged
merged 1 commit into from
May 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -2062,6 +2065,11 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation
Schema schema = body.getContent().get(contentType).getSchema();
if (schema != null && StringUtils.isNotBlank(schema.get$ref())) {
schemaName = OpenAPIUtil.getSimpleRef(schema.get$ref());
try {
schemaName = URLDecoder.decode(schemaName, StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
LOGGER.error("Could not decoded string: " + schemaName, e);
}
schema = schemas.get(schemaName);
}
final CodegenContent codegenContent = new CodegenContent(contentType);
Expand Down