Skip to content

Commit

Permalink
enable all default schemas at default :)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-toepfer committed Jun 6, 2024
1 parent b52da05 commit 8504d12
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,9 @@ public final JsonObject asJsonObject() {
public final JsonArray asJsonArray() {
return value.asJsonArray();
}

@Override
public String toString() {
return value.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,9 @@ public ValueType getValueType() {
public JsonObject asJsonObject() {
return schema.asJsonObject();
}

@Override
public String toString() {
return schema.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
import io.github.sebastiantoepfer.jsonschema.JsonSchema;
import io.github.sebastiantoepfer.jsonschema.Vocabulary;
import io.github.sebastiantoepfer.jsonschema.core.vocab.applicator.ApplicatorVocabulary;
import io.github.sebastiantoepfer.jsonschema.core.vocab.content.ContentVocabulary;
import io.github.sebastiantoepfer.jsonschema.core.vocab.core.CoreVocabulary;
import io.github.sebastiantoepfer.jsonschema.core.vocab.format.FormatAnnotationVocabulary;
import io.github.sebastiantoepfer.jsonschema.core.vocab.meta.MetaDataVocabulary;
import io.github.sebastiantoepfer.jsonschema.core.vocab.unevaluated.UnevaluatedVocabulary;
import io.github.sebastiantoepfer.jsonschema.core.vocab.validation.ValidationVocabulary;
import io.github.sebastiantoepfer.jsonschema.keyword.Keyword;
import io.github.sebastiantoepfer.jsonschema.vocabulary.spi.VocabularyDefinition;
Expand All @@ -54,7 +58,14 @@ final class Keywords {
.stream()
.collect(toMap(Vocabulary::id, Function.identity()));

DEFAULT_VOCABS = List.of(new ValidationVocabulary(JsonProvider.provider()), new ApplicatorVocabulary());
DEFAULT_VOCABS = List.of(
new ApplicatorVocabulary(),
new ValidationVocabulary(JsonProvider.provider()),
new MetaDataVocabulary(),
new FormatAnnotationVocabulary(),
new UnevaluatedVocabulary(),
new ContentVocabulary()
);
}

private final Collection<Vocabulary> vocabularies;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import io.github.sebastiantoepfer.jsonschema.core.vocab.applicator.ApplicatorVocabulary;
import io.github.sebastiantoepfer.jsonschema.core.vocab.content.ContentVocabulary;
import io.github.sebastiantoepfer.jsonschema.core.vocab.core.CoreVocabulary;
import io.github.sebastiantoepfer.jsonschema.core.vocab.format.FormatVocabulary;
import io.github.sebastiantoepfer.jsonschema.core.vocab.format.FormatAnnotationVocabulary;
import io.github.sebastiantoepfer.jsonschema.core.vocab.meta.MetaDataVocabulary;
import io.github.sebastiantoepfer.jsonschema.core.vocab.unevaluated.UnevaluatedVocabulary;
import io.github.sebastiantoepfer.jsonschema.core.vocab.validation.ValidationVocabulary;
Expand All @@ -49,7 +49,7 @@ public final class OfficialVocabularies implements LazyVocabularies {
new ApplicatorVocabulary(),
new ValidationVocabulary(JSONP),
new MetaDataVocabulary(),
new FormatVocabulary(),
new FormatAnnotationVocabulary(),
new UnevaluatedVocabulary(),
new ContentVocabulary()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
* source: https://www.learnjsonschema.com/2020-12/format-annotation/
* spec: https://json-schema.org/draft/2020-12/json-schema-validation.html#section-7.2.1
*/
public final class FormatVocabulary implements Vocabulary {
public final class FormatAnnotationVocabulary implements Vocabulary {

private final Vocabulary vocab;

public FormatVocabulary() {
public FormatAnnotationVocabulary() {
this.vocab = new DefaultVocabulary(URI.create("https://json-schema.org/draft/2020-12/vocab/format-annotation"));
}

Expand Down

0 comments on commit 8504d12

Please sign in to comment.