@Test public void defaultLibraryIsAccountedFor() { final String ref = "x://y.z/schema#"; final Library library = Library.newBuilder().freeze(); cfg.setDefaultLibrary(ref, library); assertSame(cfg.freeze().getDefaultLibrary(), library); } }
@BeforeMethod public void init() { final Keyword keyword = Keyword.newBuilder(K1) .withSyntaxChecker(mock(SyntaxChecker.class)) .withIdentityDigester(NodeType.ARRAY, NodeType.values()) .withValidatorClass(K1Validator.class) .freeze(); final Library library = DraftV4Library.get().thaw() .addKeyword(keyword).freeze(); final ValidationConfiguration cfg = ValidationConfiguration.newBuilder() .setDefaultLibrary("foo://bar#", library).freeze(); final JsonSchemaFactory factory = JsonSchemaFactory.newBuilder() .setValidationConfiguration(cfg).freeze(); processor = factory.getProcessor(); COUNT.set(0); }
.setDefaultLibrary("http://my.site/myschema#", library) .setValidationMessages(bundle).freeze();
.setDefaultLibrary("http://my.site/myschema#", library) .setValidationMessages(bundle).freeze();
/** * @param logLevel log level * @param exceptionThreshold exception threshold * @return A {@link JsonSchemaFactory} instance configured with the OpenAPI / Swagger V20 metaschema library suitable * for use in validating OpenAPI / Swagger documents */ public static JsonSchemaFactory schemaFactory(final LogLevel logLevel, final LogLevel exceptionThreshold) { return JsonSchemaFactory .newBuilder() .setValidationConfiguration( ValidationConfiguration.newBuilder() .setDefaultLibrary(OAI_V2_METASCHEMA_URI, SwaggerV20Library.get()) .setSyntaxMessages(getBundle(SwaggerV20Library.SyntaxBundle.class)) .setValidationMessages(getBundle(SwaggerV20Library.ValidationBundle.class)) .freeze()) .setReportProvider( // Only emit ERROR and above from the JSON schema validation new ListReportProvider(logLevel, exceptionThreshold)) .freeze(); }
/** * @return A {@link JsonSchemaFactory} instance configured with the OpenAPI / Swagger V20 metaschema library suitable * for use in validating OpenAPI / Swagger documents */ public static JsonSchemaFactory schemaFactory() { return JsonSchemaFactory .newBuilder() .setValidationConfiguration( ValidationConfiguration.newBuilder() .setDefaultLibrary(OAI_V2_METASCHEMA_URI, SwaggerV20Library.get()) .setSyntaxMessages(getBundle(SwaggerV20Library.SyntaxBundle.class)) .setValidationMessages(getBundle(SwaggerV20Library.ValidationBundle.class)) .freeze()) .setReportProvider( // Only emit ERROR and above from the JSON schema validation new ListReportProvider(LogLevel.ERROR, LogLevel.FATAL)) .freeze(); }
/** * @param logLevel log level * @param exceptionThreshold exception threshold * @return A {@link JsonSchemaFactory} instance configured with the OpenAPI / Swagger V20 metaschema library suitable * for use in validating OpenAPI / Swagger documents */ static JsonSchemaFactory schemaFactory(final LogLevel logLevel, final LogLevel exceptionThreshold) { return JsonSchemaFactory .newBuilder() .setValidationConfiguration( ValidationConfiguration.newBuilder() .setDefaultLibrary(OAI_V2_METASCHEMA_URI, SwaggerV20Library.get()) .setSyntaxMessages(getBundle(SwaggerV20Library.SyntaxBundle.class)) .setValidationMessages(getBundle(SwaggerV20Library.ValidationBundle.class)) .freeze()) .setReportProvider( // Only emit ERROR and above from the JSON schema validation new ListReportProvider(logLevel, exceptionThreshold)) .freeze(); }