Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
replease all path params with single 'href' param
  • Loading branch information
dkliban committed May 17, 2018
1 parent 4788eec commit e31e967
Showing 1 changed file with 17 additions and 3 deletions.
Expand Up @@ -2044,6 +2044,7 @@ public CodegenOperation fromOperation(String path,
operationId = operationId.substring(offset+1);
}
}
boolean pathParamSet = false;
operationId = removeNonNameElementToCamelCase(operationId);
op.path = path;
op.operationId = toOperationId(operationId);
Expand Down Expand Up @@ -2242,13 +2243,23 @@ public CodegenOperation fromOperation(String path,
}
}

allParams.add(p);
if (!(param instanceof PathParameter)) {
allParams.add(p);
} else if (!pathParamSet) {
p.baseName = "href";
p.dataFormat = "relative URL";
p.description = "A relative URI for the resource.";
p.unescapedDescription = "A relative URI for the resource.";
p.paramName = "href";
allParams.add(p);
}
// Issue #2561 (neilotoole) : Moved setting of is<Type>Param flags
// from here to fromParameter().
if (param instanceof QueryParameter) {
queryParams.add(p.copy());
} else if (param instanceof PathParameter) {
} else if ((param instanceof PathParameter) && (!pathParamSet)) {
pathParams.add(p.copy());
pathParamSet = true;
} else if (param instanceof HeaderParameter) {
headerParams.add(p.copy());
} else if (param instanceof CookieParameter) {
Expand All @@ -2263,7 +2274,7 @@ public CodegenOperation fromOperation(String path,
formParams.add(p.copy());
}

if (p.required) { //required parameters
if ((p.required) && !(param instanceof PathParameter)){ //required parameters
requiredParams.add(p.copy());
} else { // optional parameters
op.hasOptionalParams = true;
Expand Down Expand Up @@ -2317,6 +2328,9 @@ public int compare(CodegenParameter one, CodegenParameter another) {
op.isRestfulDestroy = op.isRestfulDestroy();
op.isRestful = op.isRestful();

if (pathParamSet) {
op.path = "{href}";
}
return op;
}

Expand Down

0 comments on commit e31e967

Please sign in to comment.