org.openapi4j.parser.validation.v3.ContactValidator 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.Contact;
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.EMAIL;
import static org.openapi4j.parser.validation.v3.OAI3Keywords.EXTENSIONS;
import static org.openapi4j.parser.validation.v3.OAI3Keywords.NAME;
import static org.openapi4j.parser.validation.v3.OAI3Keywords.URL;
class ContactValidator extends Validator3Base {
private static final Validator INSTANCE = new ContactValidator();
private ContactValidator() {
}
public static Validator instance() {
return INSTANCE;
}
@Override
public void validate(ValidationContext context, OpenApi3 api, Contact contact, ValidationResults results) {
validateString(contact.getEmail(), results, false, EMAIL_REGEX, EMAIL);
validateMap(context, api, contact.getExtensions(), results, false, EXTENSIONS, Regexes.EXT_REGEX, null);
validateString(contact.getName(), results, false, NAME);
validateUrl(api, contact.getUrl(), results, false, true, URL);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy