本文整理了Java中com.fasterxml.jackson.module.jsonSchema.JsonSchema.isStringSchema()
方法的一些代码示例,展示了JsonSchema.isStringSchema()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonSchema.isStringSchema()
方法的具体详情如下:
包路径:com.fasterxml.jackson.module.jsonSchema.JsonSchema
类名称:JsonSchema
方法名:isStringSchema
[英]determine if this JsonSchema is an StringSchema.
[中]确定此JsonSchema是否为StringSchema。
代码示例来源:origin: com.github.terran4j/terran4j-commons-api2doc
public static ApiDataType toDataType(JsonSchema schema) {
if (schema == null) {
return null;
}
if (schema.isBooleanSchema()) {
return ApiDataType.BOOLEAN;
}
if (schema.isIntegerSchema()) {
return ApiDataType.INT;
}
if (schema.isStringSchema()) {
return ApiDataType.STRING;
}
if (schema.isNumberSchema()) {
return ApiDataType.NUMBER;
}
if (schema.isObjectSchema()) {
return ApiDataType.OBJECT;
}
if (schema.isArraySchema()) {
return ApiDataType.ARRAY;
}
return null;
}
代码示例来源:origin: com.fasterxml.jackson.module/jackson-module-jsonSchema
protected JsonSchema addValidationConstraints(JsonSchema schema, BeanProperty prop) {
{
Boolean required = constraintResolver.getRequired(prop);
if (required != null) {
schema.setRequired(required);
}
}
if (schema.isArraySchema()) {
ArraySchema arraySchema = schema.asArraySchema();
arraySchema.setMaxItems(constraintResolver.getArrayMaxItems(prop));
arraySchema.setMinItems(constraintResolver.getArrayMinItems(prop));
} else if (schema.isNumberSchema()) {
NumberSchema numberSchema = schema.asNumberSchema();
numberSchema.setMaximum(constraintResolver.getNumberMaximum(prop));
numberSchema.setMinimum(constraintResolver.getNumberMinimum(prop));
} else if (schema.isStringSchema()) {
StringSchema stringSchema = schema.asStringSchema();
stringSchema.setMaxLength(constraintResolver.getStringMaxLength(prop));
stringSchema.setMinLength(constraintResolver.getStringMinLength(prop));
stringSchema.setPattern(constraintResolver.getStringPattern(prop));
}
return schema;
}
代码示例来源:origin: FasterXML/jackson-module-jsonSchema
protected JsonSchema addValidationConstraints(JsonSchema schema, BeanProperty prop) {
{
Boolean required = constraintResolver.getRequired(prop);
if (required != null) {
schema.setRequired(required);
}
}
if (schema.isArraySchema()) {
ArraySchema arraySchema = schema.asArraySchema();
arraySchema.setMaxItems(constraintResolver.getArrayMaxItems(prop));
arraySchema.setMinItems(constraintResolver.getArrayMinItems(prop));
} else if (schema.isNumberSchema()) {
NumberSchema numberSchema = schema.asNumberSchema();
numberSchema.setMaximum(constraintResolver.getNumberMaximum(prop));
numberSchema.setMinimum(constraintResolver.getNumberMinimum(prop));
} else if (schema.isStringSchema()) {
StringSchema stringSchema = schema.asStringSchema();
stringSchema.setMaxLength(constraintResolver.getStringMaxLength(prop));
stringSchema.setMinLength(constraintResolver.getStringMinLength(prop));
stringSchema.setPattern(constraintResolver.getStringPattern(prop));
}
return schema;
}
内容来源于网络,如有侵权,请联系作者删除!