Skip to content

Commit b34388e

Browse files
committed
Include information on how to show names instead of IRIs for entities
1 parent 0599d1e commit b34388e

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

admin/getting-started.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,25 @@ export default class extends Component {
225225
}
226226
```
227227

228+
### Show the Names of your Entities instead of their IRIs
229+
230+
When you install API Platform Admin, you might see objects being referred as their IRIs instead of the name you would expect to see. This is because the component looks for this information in the Hydra data.
231+
232+
To configure which property should be shown to represent your entity, you have to include the following line in the docblock preceding your property:
233+
234+
```php
235+
// api/src/Entity/Book.php
236+
237+
/**
238+
* @ApiProperty(iri="http://schema.org/name")
239+
*/
240+
private $name;
241+
```
242+
243+
Besides, it is also possible to use the documentation to customize some fields automatically while configuring the semantics of your data.
244+
245+
You can use the `http://schema.org/email` and `http://schema.org/url` properties to create an `EmailField` and an `UrlField`, respectively.
246+
228247
### Using the Hydra Data Provider Directly with react-admin
229248

230249
By default, the `HydraAdmin` component shipped with API Platform Admin will generate a convenient admin interface for every resource and every property exposed by the API. But sometimes, you may prefer having full control over the generated admin.

core/validation.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,3 +400,27 @@ final class Brand
400400
}
401401
}
402402
```
403+
404+
## Open Vocabulary generated from Validation Metadata
405+
406+
API Platform automatically detects Symfony's built-in validators and generate schema.org IRI metadata accordingly. This allows for rich clients such as the Admin component to infer the field types for most basic use cases.
407+
408+
The following validation constraints are covered:
409+
410+
Constraints | Vocabulary |
411+
--------------------------------------------------------------------------------------|-----------------------------------|
412+
[`Url`](https://symfony.com/doc/current/reference/constraints/Url.html) | `http://schema.org/url` |
413+
[`Email`](https://symfony.com/doc/current/reference/constraints/Email.html) | `http://schema.org/email` |
414+
[`Uuid`](https://symfony.com/doc/current/reference/constraints/Uuid.html) | `http://schema.org/identifier` |
415+
[`CardScheme`](https://symfony.com/doc/current/reference/constraints/CardScheme.html) | `http://schema.org/identifier` |
416+
[`Bic`](https://symfony.com/doc/current/reference/constraints/Bic.html) | `http://schema.org/identifier` |
417+
[`Iban`](https://symfony.com/doc/current/reference/constraints/Iban.html) | `http://schema.org/identifier` |
418+
[`Date`](https://symfony.com/doc/current/reference/constraints/Date.html) | `http://schema.org/Date` |
419+
[`DateTime`](https://symfony.com/doc/current/reference/constraints/DateTime.html) | `http://schema.org/DateTime` |
420+
[`Time`](https://symfony.com/doc/current/reference/constraints/Time.html) | `http://schema.org/Time` |
421+
[`Image`](https://symfony.com/doc/current/reference/constraints/Image.html) | `http://schema.org/image` |
422+
[`File`](https://symfony.com/doc/current/reference/constraints/File.html) | `http://schema.org/MediaObject` |
423+
[`Currency`](https://symfony.com/doc/current/reference/constraints/Currency.html) | `http://schema.org/priceCurrency` |
424+
[`Isbn`](https://symfony.com/doc/current/reference/constraints/Isbn.html) | `http://schema.org/isbn` |
425+
[`Issn`](https://symfony.com/doc/current/reference/constraints/Issn.html) | `http://schema.org/issn` |
426+

0 commit comments

Comments
 (0)