Skip to content

Commit 68f7d0f

Browse files
committed
Rename ValidationContext to SchemaContext
1 parent 83b6d10 commit 68f7d0f

File tree

89 files changed

+514
-511
lines changed

Some content is hidden

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

89 files changed

+514
-511
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ public interface ExecutionContextCustomizer {
2424
/**
2525
* Customize the execution context before validation.
2626
* <p>
27-
* The validation context should only be used for reference as it is shared.
27+
* The schema context should only be used for reference as it is shared.
2828
*
2929
* @param executionContext the execution context
3030
* @param schemaContext the schema context for reference
3131
*/
32-
void customize(ExecutionContext executionContext, ValidationContext schemaContext);
32+
void customize(ExecutionContext executionContext, SchemaContext schemaContext);
3333
}

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,28 +82,28 @@ default boolean matches(ExecutionContext executionContext, String value) {
8282
* Determines if the value matches the format.
8383
*
8484
* @param executionContext the execution context
85-
* @param validationContext the validation context
85+
* @param schemaContext the schema context
8686
* @param value to match
8787
* @return true if matches
8888
*/
89-
default boolean matches(ExecutionContext executionContext, ValidationContext validationContext, String value) {
89+
default boolean matches(ExecutionContext executionContext, SchemaContext schemaContext, String value) {
9090
return matches(executionContext, value);
9191
}
9292

9393
/**
9494
* Determines if the value matches the format.
9595
*
9696
* @param executionContext the execution context
97-
* @param validationContext the validation context
97+
* @param schemaContext the schema context
9898
* @param value to match
9999
* @return true if matches
100100
*/
101-
default boolean matches(ExecutionContext executionContext, ValidationContext validationContext, JsonNode value) {
102-
JsonType nodeType = TypeFactory.getValueNodeType(value, validationContext.getSchemaRegistryConfig());
101+
default boolean matches(ExecutionContext executionContext, SchemaContext schemaContext, JsonNode value) {
102+
JsonType nodeType = TypeFactory.getValueNodeType(value, schemaContext.getSchemaRegistryConfig());
103103
if (nodeType != JsonType.STRING) {
104104
return true;
105105
}
106-
return matches(executionContext, validationContext, value.textValue());
106+
return matches(executionContext, schemaContext, value.textValue());
107107
}
108108

109109
/**
@@ -112,17 +112,17 @@ default boolean matches(ExecutionContext executionContext, ValidationContext val
112112
* This can be implemented for non-string node types.
113113
*
114114
* @param executionContext the execution context
115-
* @param validationContext the validation context
115+
* @param schemaContext the schema context
116116
* @param node the node
117117
* @param rootNode the root node
118118
* @param instanceLocation the instance location
119119
* @param assertionsEnabled if assertions are enabled
120120
* @param formatValidator the format validator
121121
* @return true if matches
122122
*/
123-
default boolean matches(ExecutionContext executionContext, ValidationContext validationContext, JsonNode node,
123+
default boolean matches(ExecutionContext executionContext, SchemaContext schemaContext, JsonNode node,
124124
JsonNode rootNode, JsonNodePath instanceLocation, boolean assertionsEnabled, FormatValidator formatValidator) {
125-
return matches(executionContext, validationContext, node);
125+
return matches(executionContext, schemaContext, node);
126126
}
127127

128128
/**
@@ -131,20 +131,20 @@ default boolean matches(ExecutionContext executionContext, ValidationContext val
131131
* This is the most flexible method to implement.
132132
*
133133
* @param executionContext the execution context
134-
* @param validationContext the validation context
134+
* @param schemaContext the schema context
135135
* @param node the node
136136
* @param rootNode the root node
137137
* @param instanceLocation the instance locaiton
138138
* @param assertionsEnabled if assertions are enabled
139139
* @param message the message builder
140140
* @param formatValidator the format validator
141141
*/
142-
default void validate(ExecutionContext executionContext, ValidationContext validationContext,
142+
default void validate(ExecutionContext executionContext, SchemaContext schemaContext,
143143
JsonNode node, JsonNode rootNode, JsonNodePath instanceLocation, boolean assertionsEnabled,
144144
Supplier<MessageSourceError.Builder> message,
145145
FormatValidator formatValidator) {
146146
if (assertionsEnabled) {
147-
if (!matches(executionContext, validationContext, node, rootNode, instanceLocation, assertionsEnabled,
147+
if (!matches(executionContext, schemaContext, node, rootNode, instanceLocation, assertionsEnabled,
148148
formatValidator)) {
149149
executionContext.addError(message.get()
150150
.arguments(this.getName(), this.getErrorMessageDescription(), node.asText()).build());

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ public interface JsonSchemaIdValidator {
2929
* @param rootSchema true if this is a root schema
3030
* @param schemaLocation the schema location
3131
* @param resolvedSchemaLocation the schema location after resolving with the id
32-
* @param validationContext the validation context for instance to get the
32+
* @param schemaContext the schema context for instance to get the
3333
* meta schema
3434
* @return true if valid
3535
*/
3636
boolean validate(String id, boolean rootSchema, SchemaLocation schemaLocation,
37-
SchemaLocation resolvedSchemaLocation, ValidationContext validationContext);
37+
SchemaLocation resolvedSchemaLocation, SchemaContext schemaContext);
3838

3939
JsonSchemaIdValidator DEFAULT = new DefaultJsonSchemaIdValidator();
4040

@@ -51,7 +51,7 @@ boolean validate(String id, boolean rootSchema, SchemaLocation schemaLocation,
5151
class DefaultJsonSchemaIdValidator implements JsonSchemaIdValidator {
5252
@Override
5353
public boolean validate(String id, boolean rootSchema, SchemaLocation schemaLocation,
54-
SchemaLocation resolvedSchemaLocation, ValidationContext validationContext) {
54+
SchemaLocation resolvedSchemaLocation, SchemaContext schemaContext) {
5555
if (hasNoContext(schemaLocation)) {
5656
// The following are non-standard
5757
if (isFragment(id) || startsWithSlash(id)) {

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ public interface OutputFormat<T> {
3232
/**
3333
* Customize the execution context before validation.
3434
* <p>
35-
* The validation context should only be used for reference as it is shared.
35+
* The schema context should only be used for reference as it is shared.
3636
*
3737
* @param executionContext the execution context
3838
* @param schemaContext the schema context for reference
3939
*/
40-
default void customize(ExecutionContext executionContext, ValidationContext schemaContext) {
40+
default void customize(ExecutionContext executionContext, SchemaContext schemaContext) {
4141
}
4242

4343
/**
@@ -50,7 +50,7 @@ default void customize(ExecutionContext executionContext, ValidationContext sche
5050
* @return the result
5151
*/
5252
T format(Schema jsonSchema,
53-
ExecutionContext executionContext, ValidationContext schemaContext);
53+
ExecutionContext executionContext, SchemaContext schemaContext);
5454

5555
/**
5656
* The Default output format.
@@ -90,13 +90,13 @@ T format(Schema jsonSchema,
9090
*/
9191
class Default implements OutputFormat<java.util.List<Error>> {
9292
@Override
93-
public void customize(ExecutionContext executionContext, ValidationContext schemaContext) {
93+
public void customize(ExecutionContext executionContext, SchemaContext schemaContext) {
9494
executionContext.executionConfig(executionConfig -> executionConfig.annotationCollectionEnabled(false));
9595
}
9696

9797
@Override
9898
public java.util.List<Error> format(Schema jsonSchema,
99-
ExecutionContext executionContext, ValidationContext validationContext) {
99+
ExecutionContext executionContext, SchemaContext schemaContext) {
100100
return executionContext.getErrors();
101101
}
102102
}
@@ -106,14 +106,14 @@ public java.util.List<Error> format(Schema jsonSchema,
106106
*/
107107
class Flag implements OutputFormat<OutputFlag> {
108108
@Override
109-
public void customize(ExecutionContext executionContext, ValidationContext schemaContext) {
109+
public void customize(ExecutionContext executionContext, SchemaContext schemaContext) {
110110
executionContext.executionConfig(
111111
executionConfig -> executionConfig.annotationCollectionEnabled(false).failFast(true));
112112
}
113113

114114
@Override
115115
public OutputFlag format(Schema jsonSchema,
116-
ExecutionContext executionContext, ValidationContext validationContext) {
116+
ExecutionContext executionContext, SchemaContext schemaContext) {
117117
return new OutputFlag(executionContext.getErrors().isEmpty());
118118
}
119119
}
@@ -123,14 +123,14 @@ public OutputFlag format(Schema jsonSchema,
123123
*/
124124
class Boolean implements OutputFormat<java.lang.Boolean> {
125125
@Override
126-
public void customize(ExecutionContext executionContext, ValidationContext schemaContext) {
126+
public void customize(ExecutionContext executionContext, SchemaContext schemaContext) {
127127
executionContext.executionConfig(
128128
executionConfig -> executionConfig.annotationCollectionEnabled(false).failFast(true));
129129
}
130130

131131
@Override
132132
public java.lang.Boolean format(Schema jsonSchema,
133-
ExecutionContext executionContext, ValidationContext schemaContext) {
133+
ExecutionContext executionContext, SchemaContext schemaContext) {
134134
return executionContext.getErrors().isEmpty();
135135
}
136136
}
@@ -155,12 +155,12 @@ public List(Function<Error, Object> errorMapper) {
155155
}
156156

157157
@Override
158-
public void customize(ExecutionContext executionContext, ValidationContext schemaContext) {
158+
public void customize(ExecutionContext executionContext, SchemaContext schemaContext) {
159159
}
160160

161161
@Override
162162
public OutputUnit format(Schema jsonSchema,
163-
ExecutionContext executionContext, ValidationContext schemaContext) {
163+
ExecutionContext executionContext, SchemaContext schemaContext) {
164164
return ListOutputUnitFormatter.format(executionContext.getErrors(), executionContext, schemaContext,
165165
this.errorMapper);
166166
}
@@ -186,12 +186,12 @@ public Hierarchical(Function<Error, Object> errorMapper) {
186186
}
187187

188188
@Override
189-
public void customize(ExecutionContext executionContext, ValidationContext schemaContext) {
189+
public void customize(ExecutionContext executionContext, SchemaContext schemaContext) {
190190
}
191191

192192
@Override
193193
public OutputUnit format(Schema jsonSchema,
194-
ExecutionContext executionContext, ValidationContext schemaContext) {
194+
ExecutionContext executionContext, SchemaContext schemaContext) {
195195
return HierarchicalOutputUnitFormatter.format(jsonSchema, executionContext.getErrors(), executionContext,
196196
schemaContext, this.errorMapper);
197197
}
@@ -204,11 +204,11 @@ public OutputUnit format(Schema jsonSchema,
204204
*/
205205
class Result implements OutputFormat<ValidationResult> {
206206
@Override
207-
public void customize(ExecutionContext executionContext, ValidationContext schemaContext) {
207+
public void customize(ExecutionContext executionContext, SchemaContext schemaContext) {
208208
}
209209

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

0 commit comments

Comments
 (0)