com.fasterxml.jackson.module.jsonSchema.JsonSchema.asObjectSchema()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中com.fasterxml.jackson.module.jsonSchema.JsonSchema.asObjectSchema()方法的一些代码示例,展示了JsonSchema.asObjectSchema()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonSchema.asObjectSchema()方法的具体详情如下:
包路径:com.fasterxml.jackson.module.jsonSchema.JsonSchema
类名称:JsonSchema
方法名:asObjectSchema

JsonSchema.asObjectSchema介绍

[英]Attempt to return this JsonSchema as an ObjectSchema
[中]尝试将此JsonSchema作为ObjectSchema返回

代码示例

代码示例来源:origin: dremio/dremio-oss

private void objectExample(StringBuilder sb, int maxlength, String indent, JsonSchema schema,
  Map<String, JsonSchema> refs, Set<String> followed, Set<String> referenced, String id) {
 sb.append("{");
 if (referenced.contains(id)) {
  shortId(sb, schema);
 }
 ObjectSchema os = schema.asObjectSchema();
 if (os.getProperties().isEmpty()) {
  AdditionalProperties additionalProperties = os.getAdditionalProperties();
  if (additionalProperties instanceof SchemaAdditionalProperties) {
   sb.append("\n").append(indent).append("  ").append("abc").append(": ");
   example(sb, maxlength, indent + "  ", ((SchemaAdditionalProperties) additionalProperties).getJsonSchema(), refs, followed, referenced);
   sb.append(", ...");
  }
 }
 Map<String, JsonSchema> props = new TreeMap<>(os.getProperties());
 for (Entry<String, JsonSchema> entry : props.entrySet()) {
  sb.append("\n").append(indent).append("  ").append(entry.getKey()).append(": ");
  example(sb, maxlength, indent + "  ", entry.getValue(), refs, followed, referenced);
  sb.append(",");
 }
 sb.append("\n").append(indent).append("}");
}

代码示例来源: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.intel.icecp/icecp-core

pObject = createNewInstance(objectClass);
ObjectSchema objSchema = pSchema.asObjectSchema();
for (Entry<String, JsonSchema> obj : objSchema.getProperties().entrySet()) {
  String key = obj.getKey();

相关文章