Skip to content

Commit

Permalink
Fix apiParam name #TASK-5914
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfeSanahuja committed Jan 16, 2025
1 parent 712787c commit 0657a2f
Showing 1 changed file with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.opencb.opencga.server.generator.openapi;
import org.apache.commons.lang3.StringUtils;
import org.glassfish.jersey.media.multipart.FormDataParam;
import org.opencb.opencga.core.common.GitRepositoryState;
import org.opencb.opencga.core.tools.annotations.*;
import org.opencb.opencga.server.generator.commons.ApiCommons;
Expand Down Expand Up @@ -139,14 +140,8 @@ private List<Parameter> extractParameters(java.lang.reflect.Method method, Strin
for (java.lang.reflect.Parameter methodParam : method.getParameters()) {
// Procesar ApiParam
ApiParam apiParam = methodParam.getAnnotation(ApiParam.class);
if (apiParam != null) {
Parameter parameter = new Parameter();
parameter.setName(apiParam.name());
parameter.setDescription(apiParam.value());
parameter.setRequired(apiParam.required());
parameter.setType(methodParam.getType().getSimpleName().toLowerCase(Locale.ROOT));
parameter.setIn(determineParameterLocation(methodParam));
parameters.add(parameter);
if (apiParam == null || apiParam.hidden()) {
continue;
}

// Procesar PathParam
Expand All @@ -172,6 +167,17 @@ private List<Parameter> extractParameters(java.lang.reflect.Method method, Strin
parameter.setType(methodParam.getType().getSimpleName().toLowerCase(Locale.ROOT));
parameters.add(parameter);
}

FormDataParam formDataParam = methodParam.getAnnotation(FormDataParam.class);
if (formDataParam != null) {
Parameter parameter = new Parameter();
parameter.setName(formDataParam.value());
parameter.setIn("query");
parameter.setDescription("Query parameter: " + formDataParam.value());
parameter.setRequired(false); // Por defecto, no requerido
parameter.setType(methodParam.getType().getSimpleName().toLowerCase(Locale.ROOT));
parameters.add(parameter);
}
}

return parameters;
Expand Down

0 comments on commit 0657a2f

Please sign in to comment.