Using the Schema.org Vocabulary
API Platform Admin has native support for the popular Schema.org vocabulary.
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.
Displaying Related Resource's Name Instead of its IRI
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.
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:
// 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:
https://schema.org/email
: the field will be rendered using the<EmailField>
React Admin componenthttps://schema.org/email: フィールドは React 管理コンポーネントを使用してレンダリングされますhttps://schema.org/url
: the field will be rendered using the<UrlField>
React Admin componenthttps://schema.org/url: フィールドは React 管理コンポーネントを使用してレンダリングされますhttps://schema.org/identifier
: the field will be formatted properly in inputshttps://schema.org/identifier: フィールドは入力で適切にフォーマットされます
Note: if you already use validation on your properties, the semantics are already configured correctly (see the correspondence table)!