Table of Contents

TTMSMCPJSONSchemaGenerator.FromObject Method

Generates a schema from a live object, reflecting the class the instance actually is, so a descendant is described rather than the declared type. Uses the default settings.

API unit family: TMS.MCP.JSONSchema Declaring type: TTMSMCPJSONSchemaGenerator

Overloads

Overload 1

Generates a schema from a live object, reflecting the class the instance actually is, so a descendant is described rather than the declared type. Uses the default settings.

class function FromObject(AObject: TObject): TJSONObject; overload;

Parameters

Name Description
AObject The instance to reflect. It must not be nil; only its class is used, not its current values.

Returns

A newly created schema object owned by the caller.

Exceptions

Exception Description
EArgumentException Raised when the instance is nil.

Overload 2

Generates a schema from a live object, reflecting the class the instance actually is, so a descendant is described rather than the declared type. Uses the given settings.

class function FromObject(AObject: TObject; const AOptions: TTMSMCPJSONSchemaOptions): TJSONObject; overload;

Parameters

Name Description
AObject The instance to reflect. It must not be nil; only its class is used, not its current values.
AOptions Settings controlling which members are reflected and how the root object is emitted.

Returns

A newly created schema object owned by the caller.

Exceptions

Exception Description
EArgumentException Raised when the instance is nil.