org.openapi4j.parser.validation.v3.ServerVariableValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openapi-parser Show documentation
Show all versions of openapi-parser Show documentation
openapi4j schema parser & validator
package org.openapi4j.parser.validation.v3;
import org.openapi4j.core.validation.ValidationResults;
import org.openapi4j.parser.model.v3.OpenApi3;
import org.openapi4j.parser.model.v3.ServerVariable;
import org.openapi4j.parser.validation.ValidationContext;
import org.openapi4j.parser.validation.Validator;
import static org.openapi4j.parser.validation.v3.OAI3Keywords.*;
class ServerVariableValidator extends Validator3Base {
private static final Validator INSTANCE = new ServerVariableValidator();
private ServerVariableValidator() {
}
public static Validator instance() {
return INSTANCE;
}
@Override
public void validate(ValidationContext context, OpenApi3 api, final ServerVariable variable, final ValidationResults results) {
validateList(context, api, variable.getEnums(), results, false, 1, CRUMB_ENUM, null);
validateString(variable.getDefault(), results, true, CRUMB_DEFAULT);
validateString(variable.getDescription(), results, false, CRUMB_DESCRIPTION);
}
}