Skip to content

doc (external-vocabularies): guess IRI from validation constraints #680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions core/external-vocabularies.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,23 @@ The generated JSON for products and the related context document will now use ex
```

An extended list of existing open vocabularies is available on [the Linked Open Vocabularies (LOV) database](http://lov.okfn.org/dataset/lov/).

By default, when using [validations](validation.md) API Platform Core will try to define known [Schema.org](https://schema.org) types as IRIs for your properties if you did not provide any in your `@ApiProperty` annotations.
Built-in mapping is:

Constraints | Schema.org type |
---------------------------------------------------- |-----------------------------------|
`Symfony\Component\Validator\Constraints\Url` | `http://schema.org/url` |
`Symfony\Component\Validator\Constraints\Email` | `http://schema.org/email` |
`Symfony\Component\Validator\Constraints\Uuid` | `http://schema.org/identifier` |
`Symfony\Component\Validator\Constraints\CardScheme` | `http://schema.org/identifier` |
`Symfony\Component\Validator\Constraints\Bic` | `http://schema.org/identifier` |
`Symfony\Component\Validator\Constraints\Iban` | `http://schema.org/identifier` |
`Symfony\Component\Validator\Constraints\Date` | `http://schema.org/Date` |
`Symfony\Component\Validator\Constraints\DateTime` | `http://schema.org/DateTime` |
`Symfony\Component\Validator\Constraints\Time` | `http://schema.org/Time` |
`Symfony\Component\Validator\Constraints\Image` | `http://schema.org/image` |
`Symfony\Component\Validator\Constraints\File` | `http://schema.org/MediaObject` |
`Symfony\Component\Validator\Constraints\Currency` | `http://schema.org/priceCurrency` |
`Symfony\Component\Validator\Constraints\Isbn` | `http://schema.org/isbn` |
`Symfony\Component\Validator\Constraints\Issn` | `http://schema.org/issn` |