Skip to content
Merged
Show file tree
Hide file tree
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 @@ -225,7 +225,7 @@ apiTemplateFiles are for API outputs only (controllers/handlers).
// How to encode special characters like $
// They are translated to words like "Dollar" and prefixed with '
// Then translated back during JSON encoding and decoding
protected Map<String, String> specialCharReplacements = new HashMap<>();
protected Map<String, String> specialCharReplacements = new LinkedHashMap<>();
// When a model is an alias for a simple type
protected Map<String, String> typeAliases = null;
protected Boolean prependFormOrBodyParameters = false;
Expand Down Expand Up @@ -512,7 +512,7 @@ protected Map<String, Schema> getModelNameToSchemaCache() {
* @return map of all models indexed by names
*/
public Map<String, CodegenModel> getAllModels(Map<String, ModelsMap> objs) {
Map<String, CodegenModel> allModels = new HashMap<>();
Map<String, CodegenModel> allModels = new LinkedHashMap<>();
for (Entry<String, ModelsMap> entry : objs.entrySet()) {
String modelName = toModelName(entry.getKey());
List<ModelMap> models = entry.getValue().getModels();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,18 @@ syntax = "proto3";

package openapitools;

import public "models/lizard_all_of.proto";
import public "models/snake_all_of.proto";
import public "models/cat_all_of.proto";
import public "models/dog_all_of.proto";
import public "models/lizard_all_of.proto";

message Pet {

string petType = 140636936;

bool hasLegs = 159828448;

bool lovesRocks = 499337491;

string name = 3373707;

string bark = 3016376;

bool lovesRocks = 499337491;

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ namespace Org.OpenAPITools.Model
/// </summary>
[DataContract]
[JsonConverter(typeof(JsonSubtypes), "className")]
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
public partial class Animal : IEquatable<Animal>, IValidatableObject
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ class Animal(object):
}

discriminator_value_class_map = {
'Dog': 'Dog',
'BigCat': 'BigCat',
'Cat': 'Cat',
'BigCat': 'BigCat'
'Dog': 'Dog'
}

def __init__(self, class_name=None, color='red', local_vars_configuration=None): # noqa: E501
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ class Animal(object):
}

discriminator_value_class_map = {
'Dog': 'Dog',
'BigCat': 'BigCat',
'Cat': 'Cat',
'BigCat': 'BigCat'
'Dog': 'Dog'
}

def __init__(self, class_name=None, color='red', local_vars_configuration=None): # noqa: E501
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ class Animal(object):
}

discriminator_value_class_map = {
'Dog': 'Dog',
'BigCat': 'BigCat',
'Cat': 'Cat',
'BigCat': 'BigCat'
'Dog': 'Dog'
}

def __init__(self, class_name=None, color='red', local_vars_configuration=None): # noqa: E501
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class Animal(object):
}

discriminator_value_class_map = {
'Dog': 'Dog',
'Cat': 'Cat'
'Cat': 'Cat',
'Dog': 'Dog'
}

def __init__(self, class_name=None, color='red', local_vars_configuration=None): # noqa: E501
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,42 +160,42 @@ removeFieldLabelPrefix forParsing prefix =
where
replaceSpecialChars field = foldl (&) field (map mkCharReplacement specialChars)
specialChars =
[ ("@", "'At")
, ("\\", "'Back_Slash")
, ("<=", "'Less_Than_Or_Equal_To")
, ("\"", "'Double_Quote")
, ("[", "'Left_Square_Bracket")
, ("]", "'Right_Square_Bracket")
[ ("$", "'Dollar")
, ("^", "'Caret")
, ("_", "'Underscore")
, ("`", "'Backtick")
, ("!", "'Exclamation")
, ("#", "'Hash")
, ("$", "'Dollar")
, ("%", "'Percent")
, ("&", "'Ampersand")
, ("'", "'Quote")
, ("(", "'Left_Parenthesis")
, (")", "'Right_Parenthesis")
, ("|", "'Pipe")
, ("=", "'Equal")
, ("*", "'Star")
, ("+", "'Plus")
, (",", "'Comma")
, ("-", "'Dash")
, (".", "'Period")
, ("/", "'Slash")
, ("&", "'Ampersand")
, ("%", "'Percent")
, ("#", "'Hash")
, ("@", "'At")
, ("!", "'Exclamation")
, ("+", "'Plus")
, (":", "'Colon")
, (";", "'Semicolon")
, ("{", "'Left_Curly_Bracket")
, ("|", "'Pipe")
, (">", "'GreaterThan")
, ("<", "'LessThan")
, ("!=", "'Not_Equal")
, ("=", "'Equal")
, (".", "'Period")
, ("_", "'Underscore")
, ("?", "'Question_Mark")
, (",", "'Comma")
, ("'", "'Quote")
, ("/", "'Slash")
, ("(", "'Left_Parenthesis")
, (")", "'Right_Parenthesis")
, ("{", "'Left_Curly_Bracket")
, ("}", "'Right_Curly_Bracket")
, (">", "'GreaterThan")
, ("[", "'Left_Square_Bracket")
, ("]", "'Right_Square_Bracket")
, ("~", "'Tilde")
, ("?", "'Question_Mark")
, ("`", "'Backtick")
, ("<=", "'Less_Than_Or_Equal_To")
, (">=", "'Greater_Than_Or_Equal_To")
, ("!=", "'Not_Equal")
, ("~=", "'Tilde_Equal")
, ("\\", "'Back_Slash")
, ("\"", "'Double_Quote")
]
mkCharReplacement (replaceStr, searchStr) = T.unpack . replacer (T.pack searchStr) (T.pack replaceStr) . T.pack
replacer =
Expand Down
52 changes: 26 additions & 26 deletions samples/server/petstore/haskell-yesod/src/OpenAPIPetstore/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -130,42 +130,42 @@ removeFieldLabelPrefix forParsing prefix =
where
replaceSpecialChars field = foldl (&) field (map mkCharReplacement specialChars)
specialChars =
[ ("@", "'At")
, ("\\", "'Back_Slash")
, ("<=", "'Less_Than_Or_Equal_To")
, ("\"", "'Double_Quote")
, ("[", "'Left_Square_Bracket")
, ("]", "'Right_Square_Bracket")
[ ("$", "'Dollar")
, ("^", "'Caret")
, ("_", "'Underscore")
, ("`", "'Backtick")
, ("!", "'Exclamation")
, ("#", "'Hash")
, ("$", "'Dollar")
, ("%", "'Percent")
, ("&", "'Ampersand")
, ("'", "'Quote")
, ("(", "'Left_Parenthesis")
, (")", "'Right_Parenthesis")
, ("|", "'Pipe")
, ("=", "'Equal")
, ("*", "'Star")
, ("+", "'Plus")
, (",", "'Comma")
, ("-", "'Dash")
, (".", "'Period")
, ("/", "'Slash")
, ("&", "'Ampersand")
, ("%", "'Percent")
, ("#", "'Hash")
, ("@", "'At")
, ("!", "'Exclamation")
, ("+", "'Plus")
, (":", "'Colon")
, (";", "'Semicolon")
, ("{", "'Left_Curly_Bracket")
, ("|", "'Pipe")
, (">", "'GreaterThan")
, ("<", "'LessThan")
, ("!=", "'Not_Equal")
, ("=", "'Equal")
, (".", "'Period")
, ("_", "'Underscore")
, ("?", "'Question_Mark")
, (",", "'Comma")
, ("'", "'Quote")
, ("/", "'Slash")
, ("(", "'Left_Parenthesis")
, (")", "'Right_Parenthesis")
, ("{", "'Left_Curly_Bracket")
, ("}", "'Right_Curly_Bracket")
, (">", "'GreaterThan")
, ("[", "'Left_Square_Bracket")
, ("]", "'Right_Square_Bracket")
, ("~", "'Tilde")
, ("?", "'Question_Mark")
, ("`", "'Backtick")
, ("<=", "'Less_Than_Or_Equal_To")
, (">=", "'Greater_Than_Or_Equal_To")
, ("!=", "'Not_Equal")
, ("~=", "'Tilde_Equal")
, ("\\", "'Back_Slash")
, ("\"", "'Double_Quote")
]
mkCharReplacement (replaceStr, searchStr) = T.unpack . replacer (T.pack searchStr) (T.pack replaceStr) . T.pack
replacer =
Expand Down