Skip to content

Commit

Permalink
chore: mostly styling
Browse files Browse the repository at this point in the history
  • Loading branch information
0utplay committed Dec 22, 2024
1 parent c36ff7c commit 8618348
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public V3HttpHandlerNode(
@RequestHandler(path = "/api/v3/node/liveConsole")
public @NonNull IntoResponse<?> handleLiveConsoleRequest(
@NonNull HttpContext context,
@Optional @Valid @LogLevel @FirstRequestQueryParam("threshold") String threshold,
@FirstRequestQueryParam("threshold") @Optional @Valid @LogLevel String threshold,
@Authentication(
providers = {"ticket", "jwt"},
scopes = {"cloudnet_rest:node_read", "cloudnet_rest:node_live_console"}) @NonNull RestUser restUser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,4 @@
Class<?>[] groups() default {};

Class<? extends Payload>[] payload() default {};


}
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
import eu.cloudnetservice.ext.modules.rest.validation.LogLevel;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
import lombok.NonNull;
import org.jetbrains.annotations.Nullable;

public class LogLevelValidator implements ConstraintValidator<LogLevel, String> {
public final class LogLevelValidator implements ConstraintValidator<LogLevel, String> {

@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
public boolean isValid(@Nullable String value, @NonNull ConstraintValidatorContext context) {
return value == null || Level.toLevel(value, null) != null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,8 @@ paths:
required: false
description: |
The log level threshold. Only log entries with the same or higher log level will be sent.
The lowest level possible is the configured log level of the node itself.
The lowest level that is actually sent is the configured log level of the node itself,
requesting lower levels is possible but there is no effect.
schema:
$ref: '#/components/schemas/LogLevel'
summary: Live console
Expand All @@ -703,6 +704,8 @@ paths:
responses:
'101':
description: Switching the protocol to a websocket
'400':
$ref: '#/components/responses/Problem'
'401':
$ref: '#/components/responses/Problem'
'403':
Expand Down

0 comments on commit 8618348

Please sign in to comment.