@Override public CompletionStage<PropertyContext<?>> convert(final CompletionStage<PropertyContext<?>> cs) { return cs.thenCompose(context -> { jsonSchema.setType(context.getProperty().getType().toLowerCase(ROOT)); final String prefix = context.getProperty().getPath() + "[]"; final List<SimplePropertyDefinition> arrayElements = items.setType("object"); items.setProperties(new HashMap<>()); jsonSchema.setItems(items); final JsonSchema item = new JsonSchema(); item.setTitle(jsonSchema.getTitle()); item.setType("enum".equalsIgnoreCase(type) ? "string" : type.toLowerCase(ROOT)); jsonSchema.setItems(item);
ui.setJsonSchema(new JsonSchema()); ui.getJsonSchema().setTitle(displayName.get()); ui.getJsonSchema().setType("object"); ui .getJsonSchema()
@Override public CompletionStage<PropertyContext<?>> convert(final CompletionStage<PropertyContext<?>> cs) { return cs.thenCompose(context -> { final UiSchema schema = newUiSchema(context); setupUiSchema(context, schema); final JsonSchema jsonSchema = findJsonSchema(context); if (jsonSchema == null) { // unexpected return CompletableFuture.completedFuture(context); } if (jsonSchema.getType() == null) { jsonSchema.setType("string"); } return fillProposalsAndReturn(context, schema, jsonSchema); }); }
@Override public CompletionStage<PropertyContext<?>> convert(final CompletionStage<PropertyContext<?>> cs) { return cs.thenCompose(context -> { final UiSchema schema = newUiSchema(context); schema.setWidget("datalist"); schema.setTitleMap(emptyList()); final JsonSchema jsonSchema = findJsonSchema(context); if (jsonSchema != null) { if (jsonSchema.getType() == null) { jsonSchema.setType("string"); } // avoid to validate against the enum since we don't udpate it at suggestion time jsonSchema.setEnumValues(null); } return CompletableFuture.completedFuture(context); }); } }
return CompletableFuture.completedFuture(context); jsonSchema.setType(type.toLowerCase(ROOT)); of(context .findDirectChild(properties)
jsonSchema.setType("string");
@Override public CompletionStage<PropertyContext<?>> convert(final CompletionStage<PropertyContext<?>> cs) { return cs.thenApply(context -> { jsonSchema.setType("string"); if (context.getProperty().getValidation() == null || context.getProperty().getValidation().getEnumValues() == null) { jsonSchema.setEnumValues(emptyList()); } else { jsonSchema.setEnumValues(context.getProperty().getValidation().getEnumValues()); } return context; }); } }
public JsonSchema build() { final JsonSchema jsonSchema = new JsonSchema(); jsonSchema.setId(id); jsonSchema.setTitle(title); jsonSchema.setDescription(description); jsonSchema.setSchema(schema); jsonSchema.setRef(ref); jsonSchema.setType(type); jsonSchema.setMinItems(minItems); jsonSchema.setMaxItems(maxItems); jsonSchema.setMinLength(minLength); jsonSchema.setMaxLength(maxLength); jsonSchema.setMinimum(minimum); jsonSchema.setMaximum(maximum); jsonSchema.setUniqueItems(uniqueItems); jsonSchema.setPattern(pattern); jsonSchema.setDefaultValue(defaultValue); jsonSchema.setRequired(required); jsonSchema.setProperties(properties); jsonSchema.setEnumValues(enumValues); jsonSchema.setItems(items); return jsonSchema; } }