Skip to content

Commit

Permalink
Merge pull request #10219 from swagger-api/model_missmatch_name
Browse files Browse the repository at this point in the history
Model missmatch name fix
  • Loading branch information
HugoMario authored May 2, 2020
2 parents 215f84d + a301c61 commit ee6034a
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import javax.annotation.Nullable;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.Map.Entry;
import java.util.regex.Matcher;
Expand Down Expand Up @@ -2731,6 +2734,11 @@ public CodegenParameter fromParameter(Parameter param, Set<String> imports) {
Model sub = bp.getSchema();
if (sub instanceof RefModel) {
String name = ((RefModel) sub).getSimpleRef();
try {
name = URLDecoder.decode(name, StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
LOGGER.error("Could not decoded string: " + name, e);
}
name = getAlias(name);
if (typeMapping.containsKey(name)) {
name = typeMapping.get(name);
Expand Down

0 comments on commit ee6034a

Please sign in to comment.