Skip to content

Commit

Permalink
Replace all Table parameters with strings in the OpenAPI schema (#1439)
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianVennen authored Jan 14, 2025
1 parent 0db7ade commit 9041064
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
import io.papermc.hangar.exceptions.HangarApiException;
import io.papermc.hangar.exceptions.MethodArgumentNotValidExceptionSerializer;
import io.papermc.hangar.exceptions.MultiHangarApiException;
import io.papermc.hangar.model.db.UserTable;
import io.papermc.hangar.model.db.projects.ProjectTable;
import io.papermc.hangar.model.db.versions.ProjectVersionTable;
import io.papermc.hangar.model.db.Table;
import io.swagger.v3.core.converter.ModelConverters;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.info.Info;
Expand Down Expand Up @@ -170,7 +168,7 @@ public CustomScanner customScanner(final FilterRegistry filterRegistry) {
public static class SlugOrIdCustomizer implements ParameterCustomizer {
@Override
public Parameter customize(final Parameter parameter, final MethodParameter methodParameter) {
if (Set.of(ProjectTable.class, ProjectVersionTable.class, UserTable.class).contains(methodParameter.getParameterType())) {
if (Table.class.isAssignableFrom(methodParameter.getParameterType())) {
return parameter.schema(new StringSchema());
}
return parameter;
Expand Down

0 comments on commit 9041064

Please sign in to comment.