mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 10:58:55 +00:00
Merge pull request #2633 from yonaskolb/swift_case_sensitive_reserved_types
Make swift reserved words case sensitive again
This commit is contained in:
commit
894111e3de
@ -95,10 +95,10 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
"Empty",
|
||||
"AnyObject")
|
||||
);
|
||||
setReservedWordsLowerCase(
|
||||
reservedWords = new HashSet<String>(
|
||||
Arrays.asList(
|
||||
"Int", "Int32", "Int64", "Int64", "Float", "Double", "Bool", "Void", "String", "Character", "AnyObject",
|
||||
"class", "break", "as", "associativity", "deinit", "case", "dynamicType", "convenience", "enum", "continue",
|
||||
"class", "Class", "break", "as", "associativity", "deinit", "case", "dynamicType", "convenience", "enum", "continue",
|
||||
"false", "dynamic", "extension", "default", "is", "didSet", "func", "do", "nil", "final", "import", "else",
|
||||
"self", "get", "init", "fallthrough", "Self", "infix", "internal", "for", "super", "inout", "let", "if",
|
||||
"true", "lazy", "operator", "in", "COLUMN", "left", "private", "return", "FILE", "mutating", "protocol",
|
||||
@ -204,6 +204,11 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isReservedWord(String word) {
|
||||
return word != null && reservedWords.contains(word); //don't lowercase as super does
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeReservedWord(String name) {
|
||||
return "_" + name; // add an underscore to the name
|
||||
|
Loading…
Reference in New Issue
Block a user