Using the Schema.org Vocabulary

API Platform Admin has native support for the popular Schema.org vocabulary.

API Platform Admin は、人気のある Schema.org ボキャブラリをネイティブでサポートしています。

Schema.org is a collaborative, community activity with a mission to create, maintain, and promote schemas for structured data on the Internet, on web pages, in email messages, and beyond.

Schema.org は、インターネット、Web ページ、電子メール メッセージなどで構造化データのスキーマを作成、維持、促進することを使命とする、共同のコミュニティ活動です。

To leverage this capability, your API must use the JSON-LD format and the appropriate Schema.org types. The following examples will use API Platform Core to create such API, but keep in mind that this feature will work with any JSON-LD API using the Schema.org vocabulary, regardless of the used web framework or programming language.

この機能を利用するには、API で JSON-LD 形式と適切な Schema.org タイプを使用する必要があります。次の例では、API Platform Core を使用してそのような API を作成しますが、この機能は任意の JSON-LD API で動作することに注意してください。使用されている Web フレームワークやプログラミング言語に関係なく、Schema.org 語彙を使用します。

By default, IRIs of related objects are displayed in lists and forms. However, it is often more user-friendly to display a string representation of the resource (such as its name) instead of its ID.

デフォルトでは、関連するオブジェクトの IRI はリストとフォームに表示されます。ただし、多くの場合、ID の代わりにリソースの文字列表現 (名前など) を表示する方がユーザーフレンドリーです。

To configure which property should be shown to represent your entity, map the property containing the name of the object with the https://schema.org/name type:

エンティティを表すためにどのプロパティを表示するかを構成するには、オブジェクトの名前を含むプロパティを https://schema.org/name タイプにマップします。

// api/src/Entity/Person.php
...

#[ApiProperty(types: ["https://schema.org/name"])]
private $name;

...

Emails, URLs and Identifiers

Besides, it is also possible to use the documentation to customize some fields automatically while configuring the semantics of your data.

さらに、ドキュメントを使用して、データのセマンティクスを構成しながら、一部のフィールドを自動的にカスタマイズすることもできます。

The following Schema.org types are currently supported by API Platform Admin:

次の Schema.org タイプは、現在 API プラットフォーム管理者によってサポートされています。

  • https://schema.org/email: the field will be rendered using the <EmailField> React Admin component
    https://schema.org/email: フィールドは React 管理コンポーネントを使用してレンダリングされます
  • https://schema.org/url: the field will be rendered using the <UrlField> React Admin component
    https://schema.org/url: フィールドは React 管理コンポーネントを使用してレンダリングされます
  • https://schema.org/identifier: the field will be formatted properly in inputs
    https://schema.org/identifier: フィールドは入力で適切にフォーマットされます

Note: if you already use validation on your properties, the semantics are already configured correctly (see the correspondence table)!

注: プロパティで既に検証を使用している場合、セマンティクスは既に正しく構成されています (対応表を参照してください)。