All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openapi4j.parser.validation.v3.ServerVariableValidator Maven / Gradle / Ivy

There is a newer version: 1.0.7
Show newest version
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);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy