Skip to content

Commit

Permalink
improve $vocabulary keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-toepfer committed Oct 4, 2023
1 parent 0feaa3b commit ef05fd3
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@

import io.github.sebastiantoepfer.jsonschema.InstanceType;
import io.github.sebastiantoepfer.jsonschema.JsonSchema;
import io.github.sebastiantoepfer.jsonschema.keyword.Identifier;
import io.github.sebastiantoepfer.jsonschema.keyword.Keyword;
import io.github.sebastiantoepfer.jsonschema.keyword.KeywordType;
import io.github.sebastiantoepfer.jsonschema.vocabulary.spi.VocabularyDefinition;
import io.github.sebastiantoepfer.jsonschema.vocabulary.spi.VocabularyDefinitions;
import jakarta.json.JsonObject;
import jakarta.json.JsonValue;
import java.net.URI;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.stream.Stream;

Expand Down Expand Up @@ -62,7 +61,7 @@ public Keyword createKeyword(final JsonSchema schema, final JsonValue value) {
return result;
}

public final class VocabularyKeyword implements Keyword, VocabularyDefinitions {
public final class VocabularyKeyword implements Identifier, VocabularyDefinitions {

private final JsonObject vocabularies;

Expand All @@ -75,8 +74,8 @@ public final class VocabularyKeyword implements Keyword, VocabularyDefinitions {
}

@Override
public Collection<KeywordCategory> categories() {
return List.of();
public URI asUri() {
return definitions().map(VocabularyDefinition::id).findFirst().orElseThrow();
}

@Override
Expand Down

0 comments on commit ef05fd3

Please sign in to comment.