@Test public void cannotPutNullSyntaxMessageBundle() { try { cfg.setSyntaxMessages(null); fail("No exception thrown!!"); } catch (NullPointerException e) { assertEquals(e.getMessage(), BUNDLE.getMessage("nullMessageBundle")); } }
/** * @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 */ 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(); }
/** * @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(); }