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 @@ -118,4 +118,49 @@ public String getSwaggerType(Property p) {
type = swaggerType;
return toModelName(type);
}
}

@Override
public String toVarName(String name) {
// replace - with _ e.g. created-at => created_at
name = name.replaceAll("-", "_");

// if it's all uppper case, do nothing
if (name.matches("^[A-Z_]*$"))
return name;

// camelize (lower first character) the variable name
// pet_id => petId
name = camelize(name, true);

// for reserved word or word starting with number, append _
if(reservedWords.contains(name) || name.matches("^\\d.*"))
name = escapeReservedWord(name);

return name;
}

@Override
public String toParamName(String name) {
// should be the same as variable name
return toVarName(name);
}

@Override
public String toModelName(String name) {
// model name cannot use reserved keyword, e.g. return
if(reservedWords.contains(name))
throw new RuntimeException(name + " (reserved word) cannot be used as a model name");

// camelize the model name
// phone_number => PhoneNumber
return camelize(name);
}

@Override
public String toModelFilename(String name) {
// should be the same as the model name
return toModelName(name);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {
* maximum: {{maximum}}{{/maximum}}
**/
@ApiModelProperty(required = {{required}}, value = "{{{description}}}")
@JsonProperty("{{name}}")
@JsonProperty("{{baseName}}")
public {{{datatypeWithEnum}}} {{getter}}() {
return {{name}};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ public void updatePetWithForm (String petId, String name, String status) throws
}


public void deletePet (String api_key, Long petId) throws ApiException {
public void deletePet (String apiKey, Long petId) throws ApiException {
Object postBody = null;


Expand All @@ -400,7 +400,7 @@ public void deletePet (String api_key, Long petId) throws ApiException {



headerParams.put("api_key", ApiInvoker.parameterToString(api_key));
headerParams.put("api_key", ApiInvoker.parameterToString(apiKey));


String[] contentTypes = {
Expand Down