Navigation
API > API/Runtime > API/Runtime/JsonUtilities > API/Runtime/JsonUtilities/FJsonSchemaGenerator
Description
Derives a JSON Schema definition for Property's type.
Can be called by a developer directly, but primarily used by UStructToJsonSchemaObject(). Attention -
- Property name is not part of the returned schema.
- If calling in Editor context, metadata will be included. Otherwise, it will not. (i.e. default and min/max clamp values.)
- If Property's owner Struct is a UFunction and calling from an Editor context, metadata will only include default values if UFunction is a Blueprint function.
If Property is a struct or container of structs property etc, the nested types will be recursed into using UStructToJsonSchemaObject to derive a fully complete schema.
Importantly, the derived JSON Schema describes the JSON which would be produced by FJsonObjectConverter::UPropertyToJsonValue for a property value of this type. And conversely, any JSON adhering to this JSON Schema, may then be deserialized to this property, using FJsonObjectConverter::JsonValueToUProperty.
e.g: FBoolProperty -> { "type": "boolean" } FStrProperty & FTextProperty -> { "type": "string" } FStructProperty -> { "type": "object", "properties": { ... } }
| Name | FPropertyToJsonSchemaObject |
| Type | function |
| Header File | /Engine/Source/Runtime/JsonUtilities/Public/JsonSchema/JsonSchemaGenerator.h |
| Include Path | #include "JsonSchema/JsonSchemaGenerator.h" |
| Source | /Engine/Source/Runtime/JsonUtilities/Private/JsonSchema/JsonSchemaGenerator.cpp |
static TSharedPtr < FJsonObject > FPropertyToJsonSchemaObject
(
TNotNull< const FProperty * > Property,
const FJsonSchemaPropertyFilter & PropertyFilter,
const FJsonSchemaEditorMetadata * CachedEditorMetadata,
const void * InstanceMemory
)
Schema for the FProperty, as a JSON object.
Parameters
| Name | Remarks |
|---|---|
| Property | The property to build a schema for. |
| PropertyFilter | Determines how to filter collected struct and property data. |
| CachedEditorMetadata | If valid, use this metadata instead of collecting it. Otherwise, it will be automatically collected (if running in Editor context.) This is optional, and used for workflows that have cached metadata from an earlier process. |
| InstanceMemory | When set allows specs to be generated from FInstancedStruct and FInstancedPropertyBag. |