2.3.2 スキーマの検証

グラフ・ビジュアライゼーション・ライブラリでは、グラフのスキーマの表示に加えて、(使用可能な場合は)指定されたグラフのdataschemaに対して自動的に検証されます。

定義済の検証ルールに基づいて、グラフのdataschemaに準拠している場合(検証ルールを参照)、グラフ・ビジュアライゼーション・ライブラリは問題なく初期化されます。また、schemaがない場合、スキーマ・ビューは表示されず、スキーマ検証は実行されません。

スキーマ検証が失敗すると、次のJSON形式でエラーが表示されます:

[{
    errorType : string              // Used by consuming application to summarize or detail the error
    entityType: 'vertex' | 'edge'   // Can be used to format the error message to specify the context
    entityId?: string               // Used to identify the entity in the message
    entityDescriptor?: string[]     // Used to represent name or labels of the entity in the message
    property?: string               // Name of the property that failed validation
    expectedType?: string           // Expected type of the property
    actualType?: string             // Actual type of the property
    message?: string                // Ready to use message if no further customization is needed at the consuming side
}]

次に、それを使用するアプリケーションがmessageプロパティを使用して、インタフェースに表示するための完全なメッセージを取得できます。また、独自のカスタム・メッセージを導出したり、エラーを要約したり、エラー・メッセージに指定されているerrorTypeおよびその他のプロパティを使用してエラーを分類することもできます。