com.github.bjansen.ssv.keywords.ReadOnlyKeyword Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swagger-schema-validator Show documentation
Show all versions of swagger-schema-validator Show documentation
Validates JSON objects against a schema defined in a Swagger 2 specification.
The newest version!
package com.github.bjansen.ssv.keywords;
import com.github.fge.jackson.NodeType;
import com.github.fge.jackson.jsonpointer.JsonPointer;
import com.github.fge.jsonschema.core.keyword.syntax.checkers.AbstractSyntaxChecker;
import com.github.fge.jsonschema.core.report.ProcessingReport;
import com.github.fge.jsonschema.core.tree.SchemaTree;
import com.github.fge.jsonschema.library.Keyword;
import com.github.fge.msgsimple.bundle.MessageBundle;
import java.util.Collection;
/**
* A {@link Keyword} for the {@code readOnly} property, used to declare a property as read-only.
*/
public class ReadOnlyKeyword {
public static Keyword getInstance() {
return Keyword.newBuilder("readOnly")
.withSyntaxChecker(SyntaxChecker.INSTANCE)
.freeze();
}
private static class SyntaxChecker extends AbstractSyntaxChecker {
private static final SyntaxChecker INSTANCE = new SyntaxChecker();
private SyntaxChecker() {
super("readOnly", NodeType.BOOLEAN);
}
@Override
protected void checkValue(Collection collection,
MessageBundle messageBundle,
ProcessingReport processingReport,
SchemaTree schemaTree) {
// nothing to do
}
}
}