本文整理了Java中com.fasterxml.jackson.module.jsonSchema.JsonSchema.isArraySchema()
方法的一些代码示例,展示了JsonSchema.isArraySchema()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonSchema.isArraySchema()
方法的具体详情如下:
包路径:com.fasterxml.jackson.module.jsonSchema.JsonSchema
类名称:JsonSchema
方法名:isArraySchema
[英]determine if this JsonSchema is an ArraySchema.
[中]确定此JsonSchema是否为ArraySchema。
代码示例来源:origin: dremio/dremio-oss
followed.add(id);
objectExample(sb, maxlength, indent, schema, refs, followed, referenced, id);
} else if (schema.isArraySchema()) {
arrayExample(sb, maxlength, indent, schema, refs, followed, referenced);
} else if (schema instanceof ReferenceSchema) {
代码示例来源: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: dremio/dremio-oss
private void findRefs(JsonSchema schema, Map<String, JsonSchema> refs, Set<String> referenced) {
addRef(schema, refs);
if (schema instanceof ReferenceSchema) {
referenced.add(schema.get$ref());
} else if (schema.isArraySchema()) {
ArraySchema as = schema.asArraySchema();
if (as.getItems() != null) {
if (as.getItems().isSingleItems()) {
findRefs(as.getItems().asSingleItems().getSchema(), refs, referenced);
} else if (as.getItems().isArrayItems()) {
ArrayItems items = as.getItems().asArrayItems();
for (JsonSchema item : items.getJsonSchemas()) {
findRefs(item, refs, referenced);
}
} else {
throw new UnsupportedOperationException(as.getItems().toString());
}
}
} else if (schema.isObjectSchema()) {
ObjectSchema os = schema.asObjectSchema();
for (JsonSchema value : os.getProperties().values()) {
findRefs(value, refs, referenced);
}
}
}
代码示例来源: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;
}
内容来源于网络,如有侵权,请联系作者删除!