Skip to content

Commit df94ffa

Browse files
committed
Rename JsonSchema to Schema
1 parent bf5f620 commit df94ffa

File tree

200 files changed

+736
-736
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+736
-736
lines changed

src/main/java/com/networknt/schema/ErrorMessages.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class ErrorMessages {
1818
* @param keyword the keyword
1919
* @return the custom error message
2020
*/
21-
public static Map<String, String> getErrorMessage(JsonSchema parentSchema, String errorMessageKeyword,
21+
public static Map<String, String> getErrorMessage(Schema parentSchema, String errorMessageKeyword,
2222
String keyword) {
2323
final JsonNode message = getMessageNode(errorMessageKeyword, parentSchema.schemaNode, parentSchema, keyword);
2424
if (message != null) {
@@ -39,7 +39,7 @@ public static Map<String, String> getErrorMessage(JsonSchema parentSchema, Strin
3939
return Collections.emptyMap();
4040
}
4141

42-
protected static JsonNode getMessageNode(String errorMessageKeyword, JsonNode schemaNode, JsonSchema parentSchema,
42+
protected static JsonNode getMessageNode(String errorMessageKeyword, JsonNode schemaNode, Schema parentSchema,
4343
String pname) {
4444
if (schemaNode.get(errorMessageKeyword) != null && schemaNode.get(errorMessageKeyword).get(pname) != null) {
4545
return schemaNode.get(errorMessageKeyword);

src/main/java/com/networknt/schema/JsonSchemaFactory.java

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
import java.util.function.Consumer;
4848

4949
/**
50-
* Factory for building {@link JsonSchema} instances. The factory should be
50+
* Factory for building {@link Schema} instances. The factory should be
5151
* typically be created using {@link #getInstance(Version, Consumer)} and
5252
* should be cached for performance.
5353
* <p>
@@ -196,7 +196,7 @@ public JsonSchemaFactory build() {
196196
private final SchemaMappers.Builder schemaMappersBuilder;
197197
private final SchemaLoader schemaLoader;
198198
private final ConcurrentMap<String, Dialect> metaSchemas;
199-
private final ConcurrentMap<SchemaLocation, JsonSchema> schemaCache = new ConcurrentHashMap<>();
199+
private final ConcurrentMap<SchemaLocation, Schema> schemaCache = new ConcurrentHashMap<>();
200200
private final boolean enableSchemaCache;
201201
private final DialectRegistry metaSchemaFactory;
202202

@@ -333,9 +333,9 @@ public static Builder builder(final JsonSchemaFactory blueprint) {
333333
* @param config the config to use
334334
* @return the schema
335335
*/
336-
protected JsonSchema newJsonSchema(final SchemaLocation schemaUri, final JsonNode schemaNode, final SchemaValidatorsConfig config) {
336+
protected Schema newJsonSchema(final SchemaLocation schemaUri, final JsonNode schemaNode, final SchemaValidatorsConfig config) {
337337
final ValidationContext validationContext = createValidationContext(schemaNode, config);
338-
JsonSchema jsonSchema = doCreate(validationContext, getSchemaLocation(schemaUri),
338+
Schema jsonSchema = doCreate(validationContext, getSchemaLocation(schemaUri),
339339
new JsonNodePath(validationContext.getConfig().getPathType()), schemaNode, null, false);
340340
preload(jsonSchema, config);
341341
return jsonSchema;
@@ -347,7 +347,7 @@ protected JsonSchema newJsonSchema(final SchemaLocation schemaUri, final JsonNod
347347
* @param jsonSchema the schema to preload
348348
* @param config containing the configuration option
349349
*/
350-
private void preload(JsonSchema jsonSchema, SchemaValidatorsConfig config) {
350+
private void preload(Schema jsonSchema, SchemaValidatorsConfig config) {
351351
if (config.isPreloadJsonSchema()) {
352352
try {
353353
/*
@@ -365,12 +365,12 @@ private void preload(JsonSchema jsonSchema, SchemaValidatorsConfig config) {
365365
}
366366
}
367367

368-
public JsonSchema create(ValidationContext validationContext, SchemaLocation schemaLocation, JsonNodePath evaluationPath, JsonNode schemaNode, JsonSchema parentSchema) {
368+
public Schema create(ValidationContext validationContext, SchemaLocation schemaLocation, JsonNodePath evaluationPath, JsonNode schemaNode, Schema parentSchema) {
369369
return doCreate(validationContext, schemaLocation, evaluationPath, schemaNode, parentSchema, false);
370370
}
371371

372-
private JsonSchema doCreate(ValidationContext validationContext, SchemaLocation schemaLocation, JsonNodePath evaluationPath, JsonNode schemaNode, JsonSchema parentSchema, boolean suppressSubSchemaRetrieval) {
373-
return JsonSchema.from(withMetaSchema(validationContext, schemaNode), schemaLocation, evaluationPath,
372+
private Schema doCreate(ValidationContext validationContext, SchemaLocation schemaLocation, JsonNodePath evaluationPath, JsonNode schemaNode, Schema parentSchema, boolean suppressSubSchemaRetrieval) {
373+
return Schema.from(withMetaSchema(validationContext, schemaNode), schemaLocation, evaluationPath,
374374
schemaNode, parentSchema, suppressSubSchemaRetrieval);
375375
}
376376

@@ -509,7 +509,7 @@ ObjectMapper getObjectMapper(InputFormat inputFormat) {
509509
* @param config the config
510510
* @return the schema
511511
*/
512-
public JsonSchema getSchema(final String schema, final SchemaValidatorsConfig config) {
512+
public Schema getSchema(final String schema, final SchemaValidatorsConfig config) {
513513
return getSchema(schema, InputFormat.JSON, config);
514514
}
515515

@@ -524,7 +524,7 @@ public JsonSchema getSchema(final String schema, final SchemaValidatorsConfig co
524524
* @param config the config
525525
* @return the schema
526526
*/
527-
public JsonSchema getSchema(final String schema, InputFormat inputFormat, final SchemaValidatorsConfig config) {
527+
public Schema getSchema(final String schema, InputFormat inputFormat, final SchemaValidatorsConfig config) {
528528
try {
529529
final JsonNode schemaNode = readTree(schema, inputFormat);
530530
return newJsonSchema(null, schemaNode, config);
@@ -544,7 +544,7 @@ public JsonSchema getSchema(final String schema, InputFormat inputFormat, final
544544
* @param schema the schema data as a string
545545
* @return the schema
546546
*/
547-
public JsonSchema getSchema(final String schema) {
547+
public Schema getSchema(final String schema) {
548548
return getSchema(schema, createSchemaValidatorsConfig());
549549
}
550550

@@ -558,7 +558,7 @@ public JsonSchema getSchema(final String schema) {
558558
* @param inputFormat input format
559559
* @return the schema
560560
*/
561-
public JsonSchema getSchema(final String schema, InputFormat inputFormat) {
561+
public Schema getSchema(final String schema, InputFormat inputFormat) {
562562
return getSchema(schema, inputFormat, createSchemaValidatorsConfig());
563563
}
564564

@@ -572,7 +572,7 @@ public JsonSchema getSchema(final String schema, InputFormat inputFormat) {
572572
* @param config the config
573573
* @return the schema
574574
*/
575-
public JsonSchema getSchema(final InputStream schemaStream, final SchemaValidatorsConfig config) {
575+
public Schema getSchema(final InputStream schemaStream, final SchemaValidatorsConfig config) {
576576
return getSchema(schemaStream, InputFormat.JSON, config);
577577
}
578578

@@ -587,7 +587,7 @@ public JsonSchema getSchema(final InputStream schemaStream, final SchemaValidato
587587
* @param config the config
588588
* @return the schema
589589
*/
590-
public JsonSchema getSchema(final InputStream schemaStream, InputFormat inputFormat, final SchemaValidatorsConfig config) {
590+
public Schema getSchema(final InputStream schemaStream, InputFormat inputFormat, final SchemaValidatorsConfig config) {
591591
try {
592592
final JsonNode schemaNode = readTree(schemaStream, inputFormat);
593593
return newJsonSchema(null, schemaNode, config);
@@ -606,7 +606,7 @@ public JsonSchema getSchema(final InputStream schemaStream, InputFormat inputFor
606606
* @param schemaStream the input stream with the schema data
607607
* @return the schema
608608
*/
609-
public JsonSchema getSchema(final InputStream schemaStream) {
609+
public Schema getSchema(final InputStream schemaStream) {
610610
return getSchema(schemaStream, createSchemaValidatorsConfig());
611611
}
612612

@@ -617,8 +617,8 @@ public JsonSchema getSchema(final InputStream schemaStream) {
617617
* @param config the config
618618
* @return the schema
619619
*/
620-
public JsonSchema getSchema(final SchemaLocation schemaUri, final SchemaValidatorsConfig config) {
621-
JsonSchema schema = loadSchema(schemaUri, config);
620+
public Schema getSchema(final SchemaLocation schemaUri, final SchemaValidatorsConfig config) {
621+
Schema schema = loadSchema(schemaUri, config);
622622
preload(schema, config);
623623
return schema;
624624
}
@@ -630,12 +630,12 @@ public JsonSchema getSchema(final SchemaLocation schemaUri, final SchemaValidato
630630
* @param config the config
631631
* @return the schema
632632
*/
633-
public JsonSchema loadSchema(final SchemaLocation schemaUri, final SchemaValidatorsConfig config) {
633+
public Schema loadSchema(final SchemaLocation schemaUri, final SchemaValidatorsConfig config) {
634634
if (enableSchemaCache) {
635635
// ConcurrentHashMap computeIfAbsent does not allow calls that result in a
636636
// recursive update to the map.
637637
// The getMapperSchema potentially recurses to call back to getSchema again
638-
JsonSchema cachedUriSchema = schemaCache.get(schemaUri);
638+
Schema cachedUriSchema = schemaCache.get(schemaUri);
639639
if (cachedUriSchema == null) {
640640
synchronized (this) { // acquire lock on shared factory object to prevent deadlock
641641
cachedUriSchema = schemaCache.get(schemaUri);
@@ -670,7 +670,7 @@ protected SchemaValidatorsConfig createSchemaValidatorsConfig() {
670670
return new SchemaValidatorsConfig();
671671
}
672672

673-
protected JsonSchema getMappedSchema(final SchemaLocation schemaUri, SchemaValidatorsConfig config) {
673+
protected Schema getMappedSchema(final SchemaLocation schemaUri, SchemaValidatorsConfig config) {
674674
try (InputStream inputStream = this.schemaLoader.getSchema(schemaUri.getAbsoluteIri()).getInputStream()) {
675675
if (inputStream == null) {
676676
throw new IOException("Cannot load schema at " + schemaUri);
@@ -693,7 +693,7 @@ protected JsonSchema getMappedSchema(final SchemaLocation schemaUri, SchemaValid
693693
// Schema with fragment pointing to sub schema
694694
final ValidationContext validationContext = createValidationContext(schemaNode, config);
695695
SchemaLocation documentLocation = new SchemaLocation(schemaUri.getAbsoluteIri());
696-
JsonSchema document = doCreate(validationContext, documentLocation, evaluationPath, schemaNode, null, false);
696+
Schema document = doCreate(validationContext, documentLocation, evaluationPath, schemaNode, null, false);
697697
return document.getRefSchema(schemaUri.getFragment());
698698
}
699699
} catch (IOException e) {
@@ -710,7 +710,7 @@ protected JsonSchema getMappedSchema(final SchemaLocation schemaUri, SchemaValid
710710
* @param schemaUri the absolute IRI of the schema which can map to the retrieval IRI.
711711
* @return the schema
712712
*/
713-
public JsonSchema getSchema(final URI schemaUri) {
713+
public Schema getSchema(final URI schemaUri) {
714714
return getSchema(SchemaLocation.of(schemaUri.toString()), createSchemaValidatorsConfig());
715715
}
716716

@@ -722,7 +722,7 @@ public JsonSchema getSchema(final URI schemaUri) {
722722
* @param config the config
723723
* @return the schema
724724
*/
725-
public JsonSchema getSchema(final URI schemaUri, final JsonNode jsonNode, final SchemaValidatorsConfig config) {
725+
public Schema getSchema(final URI schemaUri, final JsonNode jsonNode, final SchemaValidatorsConfig config) {
726726
return newJsonSchema(SchemaLocation.of(schemaUri.toString()), jsonNode, config);
727727
}
728728

@@ -733,7 +733,7 @@ public JsonSchema getSchema(final URI schemaUri, final JsonNode jsonNode, final
733733
* @param jsonNode the node
734734
* @return the schema
735735
*/
736-
public JsonSchema getSchema(final URI schemaUri, final JsonNode jsonNode) {
736+
public Schema getSchema(final URI schemaUri, final JsonNode jsonNode) {
737737
return newJsonSchema(SchemaLocation.of(schemaUri.toString()), jsonNode, createSchemaValidatorsConfig());
738738
}
739739

@@ -743,7 +743,7 @@ public JsonSchema getSchema(final URI schemaUri, final JsonNode jsonNode) {
743743
* @param schemaUri the absolute IRI of the schema which can map to the retrieval IRI.
744744
* @return the schema
745745
*/
746-
public JsonSchema getSchema(final SchemaLocation schemaUri) {
746+
public Schema getSchema(final SchemaLocation schemaUri) {
747747
return getSchema(schemaUri, createSchemaValidatorsConfig());
748748
}
749749

@@ -755,7 +755,7 @@ public JsonSchema getSchema(final SchemaLocation schemaUri) {
755755
* @param config the config
756756
* @return the schema
757757
*/
758-
public JsonSchema getSchema(final SchemaLocation schemaUri, final JsonNode jsonNode, final SchemaValidatorsConfig config) {
758+
public Schema getSchema(final SchemaLocation schemaUri, final JsonNode jsonNode, final SchemaValidatorsConfig config) {
759759
return newJsonSchema(schemaUri, jsonNode, config);
760760
}
761761

@@ -766,7 +766,7 @@ public JsonSchema getSchema(final SchemaLocation schemaUri, final JsonNode jsonN
766766
* @param jsonNode the node
767767
* @return the schema
768768
*/
769-
public JsonSchema getSchema(final SchemaLocation schemaUri, final JsonNode jsonNode) {
769+
public Schema getSchema(final SchemaLocation schemaUri, final JsonNode jsonNode) {
770770
return newJsonSchema(schemaUri, jsonNode, createSchemaValidatorsConfig());
771771
}
772772

@@ -783,7 +783,7 @@ public JsonSchema getSchema(final SchemaLocation schemaUri, final JsonNode jsonN
783783
* @param config the config
784784
* @return the schema
785785
*/
786-
public JsonSchema getSchema(final JsonNode jsonNode, final SchemaValidatorsConfig config) {
786+
public Schema getSchema(final JsonNode jsonNode, final SchemaValidatorsConfig config) {
787787
return newJsonSchema(null, jsonNode, config);
788788
}
789789

@@ -799,7 +799,7 @@ public JsonSchema getSchema(final JsonNode jsonNode, final SchemaValidatorsConfi
799799
* @param jsonNode the node
800800
* @return the schema
801801
*/
802-
public JsonSchema getSchema(final JsonNode jsonNode) {
802+
public Schema getSchema(final JsonNode jsonNode) {
803803
return newJsonSchema(null, jsonNode, createSchemaValidatorsConfig());
804804
}
805805

src/main/java/com/networknt/schema/JsonSchemaRef.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
*/
2323
public class JsonSchemaRef {
2424

25-
private final Supplier<JsonSchema> schemaSupplier;
25+
private final Supplier<Schema> schemaSupplier;
2626

27-
public JsonSchemaRef(Supplier<JsonSchema> schema) {
27+
public JsonSchemaRef(Supplier<Schema> schema) {
2828
this.schemaSupplier = schema;
2929
}
3030

31-
public JsonSchema getSchema() {
31+
public Schema getSchema() {
3232
return this.schemaSupplier.get();
3333
}
3434
}

src/main/java/com/networknt/schema/OutputFormat.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ default void customize(ExecutionContext executionContext, ValidationContext vali
4949
*
5050
* @return the result
5151
*/
52-
T format(JsonSchema jsonSchema,
52+
T format(Schema jsonSchema,
5353
ExecutionContext executionContext, ValidationContext validationContext);
5454

5555
/**
@@ -95,7 +95,7 @@ public void customize(ExecutionContext executionContext, ValidationContext valid
9595
}
9696

9797
@Override
98-
public java.util.List<Error> format(JsonSchema jsonSchema,
98+
public java.util.List<Error> format(Schema jsonSchema,
9999
ExecutionContext executionContext, ValidationContext validationContext) {
100100
return executionContext.getErrors();
101101
}
@@ -112,7 +112,7 @@ public void customize(ExecutionContext executionContext, ValidationContext valid
112112
}
113113

114114
@Override
115-
public OutputFlag format(JsonSchema jsonSchema,
115+
public OutputFlag format(Schema jsonSchema,
116116
ExecutionContext executionContext, ValidationContext validationContext) {
117117
return new OutputFlag(executionContext.getErrors().isEmpty());
118118
}
@@ -129,7 +129,7 @@ public void customize(ExecutionContext executionContext, ValidationContext valid
129129
}
130130

131131
@Override
132-
public java.lang.Boolean format(JsonSchema jsonSchema,
132+
public java.lang.Boolean format(Schema jsonSchema,
133133
ExecutionContext executionContext, ValidationContext validationContext) {
134134
return executionContext.getErrors().isEmpty();
135135
}
@@ -159,7 +159,7 @@ public void customize(ExecutionContext executionContext, ValidationContext valid
159159
}
160160

161161
@Override
162-
public OutputUnit format(JsonSchema jsonSchema,
162+
public OutputUnit format(Schema jsonSchema,
163163
ExecutionContext executionContext, ValidationContext validationContext) {
164164
return ListOutputUnitFormatter.format(executionContext.getErrors(), executionContext, validationContext,
165165
this.errorMapper);
@@ -190,7 +190,7 @@ public void customize(ExecutionContext executionContext, ValidationContext valid
190190
}
191191

192192
@Override
193-
public OutputUnit format(JsonSchema jsonSchema,
193+
public OutputUnit format(Schema jsonSchema,
194194
ExecutionContext executionContext, ValidationContext validationContext) {
195195
return HierarchicalOutputUnitFormatter.format(jsonSchema, executionContext.getErrors(), executionContext,
196196
validationContext, this.errorMapper);
@@ -208,7 +208,7 @@ public void customize(ExecutionContext executionContext, ValidationContext valid
208208
}
209209

210210
@Override
211-
public ValidationResult format(JsonSchema jsonSchema,ExecutionContext executionContext, ValidationContext validationContext) {
211+
public ValidationResult format(Schema jsonSchema,ExecutionContext executionContext, ValidationContext validationContext) {
212212
return new ValidationResult(executionContext);
213213
}
214214
}

0 commit comments

Comments
 (0)