@Test public void validateApiSpecStyleFail() throws Exception { ApiValidationResults results = Oas3Validator.validate("src/test/resources/petstore-validation-style-fail.yaml"); assertTrue(results.getSpecificationValidationResult().isSuccess()); assertFalse(results.getStyleValidationResult().isSuccess()); }
public static ApiValidationResults validate(String apiSpecPath) throws ResolutionException { if (apiSpecPath == null) { throw new IllegalArgumentException("API definition document path is required"); } File apiSpecFile = new File(apiSpecPath); String apiSpecFilePath = apiSpecFile.getAbsolutePath(); System.out.println(System.lineSeparator() + "Validating API specification: " + apiSpecFilePath); ApiValidationResult specValidationResult = validateOpenApiSpec(apiSpecFile); ApiValidationResult styleValidationResult = validateOpenApiSpecStyle(apiSpecFilePath); boolean isSuccess = specValidationResult.isSuccess() && styleValidationResult.isSuccess(); System.out.println("Validating API specification: " + apiSpecFilePath + " -> " + (isSuccess ? "SUCCESS" : "FAILED")); printValidationResults(specValidationResult); printValidationResults(styleValidationResult); ApiValidationResults apiValidationResults = new ApiValidationResults(); apiValidationResults.setApiDefinitionPath(apiSpecPath); apiValidationResults.setSpecificationValidationResult(specValidationResult); apiValidationResults.setStyleValidationResult(styleValidationResult); return apiValidationResults; }
Oas3Validator { public static ApiValidationResults validate(String apiSpecPath) throws ResolutionException { if (apiSpecPath == null) { throw new IllegalArgumentException("API definition document path is required"); } File apiSpecFile = new File(apiSpecPath); String apiSpecFilePath = apiSpecFile.getAbsolutePath(); System.out.println(System.lineSeparator() + "Validating API specification: " + apiSpecFilePath); ApiValidationResult specValidationResult = validateOpenApiSpec(apiSpecFile); ApiValidationResult styleValidationResult = validateOpenApiSpecStyle(apiSpecFilePath); boolean isSuccess = specValidationResult.isSuccess() && styleValidationResult.isSuccess(); System.out.println("Validating API specification: " + apiSpecFilePath + " -> " + (isSuccess ? "SUCCESS" : "FAILED")); printValidationResults(specValidationResult); printValidationResults(styleValidationResult); ApiValidationResults apiValidationResults = new ApiValidationResults(); apiValidationResults.setApiDefinitionPath(apiSpecPath); apiValidationResults.setSpecificationValidationResult(specValidationResult); apiValidationResults.setStyleValidationResult(styleValidationResult); return apiValidationResults; } }
Oas3Validator { public static ApiValidationResults validate(String apiSpecPath) throws ResolutionException { if (apiSpecPath == null) { throw new IllegalArgumentException("API definition document path is required"); } File apiSpecFile = new File(apiSpecPath); String apiSpecFilePath = apiSpecFile.getAbsolutePath(); System.out.println(System.lineSeparator() + "Validating API specification: " + apiSpecFilePath); ApiValidationResult specValidationResult = validateOpenApiSpec(apiSpecFile); ApiValidationResult styleValidationResult = validateOpenApiSpecStyle(apiSpecFilePath); boolean isSuccess = specValidationResult.isSuccess() && styleValidationResult.isSuccess(); System.out.println("Validating API specification: " + apiSpecFilePath + " -> " + (isSuccess ? "SUCCESS" : "FAILED")); printValidationResults(specValidationResult); printValidationResults(styleValidationResult); ApiValidationResults apiValidationResults = new ApiValidationResults(); apiValidationResults.setApiDefinitionPath(apiSpecPath); apiValidationResults.setSpecificationValidationResult(specValidationResult); apiValidationResults.setStyleValidationResult(styleValidationResult); return apiValidationResults; } private  Oas3Validator(); }
Oas3Validator { public static ApiValidationResults validate(String apiSpecPath) throws ResolutionException { if (apiSpecPath == null) { throw new IllegalArgumentException("API definition document path is required"); } File apiSpecFile = new File(apiSpecPath); String apiSpecFilePath = apiSpecFile.getAbsolutePath(); System.out.println(System.lineSeparator() + "Validating API specification: " + apiSpecFilePath); ApiValidationResult specValidationResult = validateOpenApiSpec(apiSpecFile); ApiValidationResult styleValidationResult = validateOpenApiSpecStyle(apiSpecFilePath); boolean isSuccess = specValidationResult.isSuccess() && styleValidationResult.isSuccess(); System.out.println("Validating API specification: " + apiSpecFilePath + " -> " + (isSuccess ? "SUCCESS" : "FAILED")); printValidationResults(specValidationResult); printValidationResults(styleValidationResult); ApiValidationResults apiValidationResults = new ApiValidationResults(); apiValidationResults.setApiDefinitionPath(apiSpecPath); apiValidationResults.setSpecificationValidationResult(specValidationResult); apiValidationResults.setStyleValidationResult(styleValidationResult); return apiValidationResults; } private  Oas3Validator(); static ApiValidationResults validate(String apiSpecPath); }
Oas3Validator { public static ApiValidationResults validate(String apiSpecPath) throws ResolutionException { if (apiSpecPath == null) { throw new IllegalArgumentException("API definition document path is required"); } File apiSpecFile = new File(apiSpecPath); String apiSpecFilePath = apiSpecFile.getAbsolutePath(); System.out.println(System.lineSeparator() + "Validating API specification: " + apiSpecFilePath); ApiValidationResult specValidationResult = validateOpenApiSpec(apiSpecFile); ApiValidationResult styleValidationResult = validateOpenApiSpecStyle(apiSpecFilePath); boolean isSuccess = specValidationResult.isSuccess() && styleValidationResult.isSuccess(); System.out.println("Validating API specification: " + apiSpecFilePath + " -> " + (isSuccess ? "SUCCESS" : "FAILED")); printValidationResults(specValidationResult); printValidationResults(styleValidationResult); ApiValidationResults apiValidationResults = new ApiValidationResults(); apiValidationResults.setApiDefinitionPath(apiSpecPath); apiValidationResults.setSpecificationValidationResult(specValidationResult); apiValidationResults.setStyleValidationResult(styleValidationResult); return apiValidationResults; } private  Oas3Validator(); static ApiValidationResults validate(String apiSpecPath);  }