Example #1
0
 public static JsonNode getJsonSchemaNode(Class<?> cls) {
   JsonNode schemaRootNode = null;
   JsonSchema jsonSchema = getJsonSchema(cls);
   if (jsonSchema != null) {
     schemaRootNode = jsonSchema.getSchemaNode();
   }
   return schemaRootNode;
 }
Example #2
0
/*     */   public JsonNode getSchema(SerializerProvider provider, Type typeHint)
/*     */     throws JsonMappingException
/*     */   {
/* 203 */     ObjectNode o = createSchemaNode("array", true);
/* 204 */     if (typeHint != null) {
/* 205 */       JavaType javaType = TypeFactory.type(typeHint);
/* 206 */       if (javaType.isArrayType()) {
/* 207 */         Class componentType = ((ArrayType)javaType).getContentType().getRawClass();
/*     */ 
/* 209 */         if (componentType == Object.class) {
/* 210 */           o.put("items", JsonSchema.getDefaultSchemaNode());
/*     */         } else {
/* 212 */           JsonSerializer ser = provider.findValueSerializer(componentType, this._property);
/* 213 */           JsonNode schemaNode = (ser instanceof SchemaAware) ? ((SchemaAware)ser).getSchema(provider, null) : JsonSchema.getDefaultSchemaNode();
/*     */ 
/* 216 */           o.put("items", schemaNode);
/*     */         }
/*     */       }
/*     */     }
/* 220 */     return o;
/*     */   }
Example #3
0
 public static String schemaToFormattedJsonString(JsonSchema schema) {
   return mapToFormattedJsonString(schema.getSchemaNode());
 }