org.openapi4j.parser.validation.v3.InfoValidator 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.Info;
import org.openapi4j.parser.model.v3.OpenApi3;
import org.openapi4j.parser.validation.ValidationContext;
import org.openapi4j.parser.validation.Validator;
import static org.openapi4j.parser.validation.v3.OAI3Keywords.CONTACT;
import static org.openapi4j.parser.validation.v3.OAI3Keywords.EXTENSIONS;
import static org.openapi4j.parser.validation.v3.OAI3Keywords.LICENSE;
import static org.openapi4j.parser.validation.v3.OAI3Keywords.TERMSOFSERVICE;
import static org.openapi4j.parser.validation.v3.OAI3Keywords.TITLE;
import static org.openapi4j.parser.validation.v3.OAI3Keywords.VERSION;
class InfoValidator extends Validator3Base {
private static final Validator INSTANCE = new InfoValidator();
private InfoValidator() {
}
public static Validator instance() {
return INSTANCE;
}
@Override
public void validate(ValidationContext context, OpenApi3 api, Info info, ValidationResults results) {
// VALIDATION EXCLUSIONS :
// description
validateField(context, api, info.getContact(), results, false, CONTACT, ContactValidator.instance());
validateMap(context, api, info.getExtensions(), results, false, EXTENSIONS, Regexes.EXT_REGEX, null);
validateField(context, api, info.getLicense(), results, false, LICENSE, LicenseValidator.instance());
validateUrl(api, info.getTermsOfService(), results, false, true, TERMSOFSERVICE);
validateString(info.getTitle(), results, true, TITLE);
validateString(info.getVersion(), results, true, VERSION);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy