Skip to content

Commit 292502b

Browse files
doc (external-vocabularies): guess IRI from validation constraints
1 parent 4403515 commit 292502b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

core/external-vocabularies.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,23 @@ The generated JSON for products and the related context document will now use ex
5555
```
5656

5757
An extended list of existing open vocabularies is available on [the Linked Open Vocabularies (LOV) database](http://lov.okfn.org/dataset/lov/).
58+
59+
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.
60+
Built-in mapping is:
61+
62+
Constraints | Schema.org type |
63+
---------------------------------------------------- |-----------------------------------|
64+
`Symfony\Component\Validator\Constraints\Url` | `http://schema.org/url` |
65+
`Symfony\Component\Validator\Constraints\Email` | `http://schema.org/email` |
66+
`Symfony\Component\Validator\Constraints\Uuid` | `http://schema.org/identifier` |
67+
`Symfony\Component\Validator\Constraints\CardScheme` | `http://schema.org/identifier` |
68+
`Symfony\Component\Validator\Constraints\Bic` | `http://schema.org/identifier` |
69+
`Symfony\Component\Validator\Constraints\Iban` | `http://schema.org/identifier` |
70+
`Symfony\Component\Validator\Constraints\Date` | `http://schema.org/Date` |
71+
`Symfony\Component\Validator\Constraints\DateTime` | `http://schema.org/DateTime` |
72+
`Symfony\Component\Validator\Constraints\Time` | `http://schema.org/Time` |
73+
`Symfony\Component\Validator\Constraints\Image` | `http://schema.org/image` |
74+
`Symfony\Component\Validator\Constraints\File` | `http://schema.org/MediaObject` |
75+
`Symfony\Component\Validator\Constraints\Currency` | `http://schema.org/priceCurrency` |
76+
`Symfony\Component\Validator\Constraints\Isbn` | `http://schema.org/isbn` |
77+
`Symfony\Component\Validator\Constraints\Issn` | `http://schema.org/issn` |

0 commit comments

Comments
 (0)