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.DEFAULT;
import static org.openapi4j.parser.validation.v3.OAI3Keywords.DESCRIPTION;
import static org.openapi4j.parser.validation.v3.OAI3Keywords.ENUM;
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, ENUM, null);
validateString(variable.getDefault(), results, true, DEFAULT);
validateString(variable.getDescription(), results, false, DESCRIPTION);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy