@Test public void testValidate() { OpenAPI openAPI = loadRelative("petstore-operation-id-lower-camel-case.yaml"); OasSpecValidator oasSpecValidator = oasSpecValidatorFactory.create( singleOption(OperationIdCaseValidator.CONFIG_KEY, "lower-camel-case") ); List<OasViolation> violations = oasSpecValidator.validate(createContext(openAPI), openAPI); assertThat(violations).containsExactly( createViolation(OperationIdCaseValidator.ERROR + "lower-camel-case", "paths", PATHS, "/pets", PATH_ITEM, "get", OPERATION, "operationId", null)); }
@Override public List<OasViolation> validate(OasValidationContext context, OasObjectPropertyLocation location, Operation oasObject) { if (!isMatchCase(expectedCase, oasObject.getOperationId())) { return singletonList(new OasViolation(location.property("operationId"), ERROR + expectedCase)); } return emptyList(); }
OperationIdCaseValidator implements OperationValidator { @Override public List<OasViolation> validate(OasValidationContext context, OasObjectPropertyLocation location, Operation oasObject) { if (!isMatchCase(expectedCase, oasObject.getOperationId())) { return singletonList(new OasViolation(location.property("operationId"), ERROR + expectedCase)); } return emptyList(); } }
OperationIdCaseValidator implements OperationValidator { @Override public List<OasViolation> validate(OasValidationContext context, OasObjectPropertyLocation location, Operation oasObject) { if (!isMatchCase(expectedCase, oasObject.getOperationId())) { return singletonList(new OasViolation(location.property("operationId"), ERROR + expectedCase)); } return emptyList(); } OperationIdCaseValidator(String expectedCase); }
OperationIdCaseValidator implements OperationValidator { @Override public List<OasViolation> validate(OasValidationContext context, OasObjectPropertyLocation location, Operation oasObject) { if (!isMatchCase(expectedCase, oasObject.getOperationId())) { return singletonList(new OasViolation(location.property("operationId"), ERROR + expectedCase)); } return emptyList(); } OperationIdCaseValidator(String expectedCase); @Override List<OasViolation> validate(OasValidationContext context, OasObjectPropertyLocation location,
    Operation oasObject); }
OperationIdCaseValidator implements OperationValidator { @Override public List<OasViolation> validate(OasValidationContext context, OasObjectPropertyLocation location, Operation oasObject) { if (!isMatchCase(expectedCase, oasObject.getOperationId())) { return singletonList(new OasViolation(location.property("operationId"), ERROR + expectedCase)); } return emptyList(); } OperationIdCaseValidator(String expectedCase); @Override List<OasViolation> validate(OasValidationContext context, OasObjectPropertyLocation location,
    Operation oasObject); static final String CONFIG_KEY; static final String ERROR; }