diff --git a/core/extending-jsonld-context.md b/core/extending-jsonld-context.md index a832704fad7..878230c9e4b 100644 --- a/core/extending-jsonld-context.md +++ b/core/extending-jsonld-context.md @@ -23,7 +23,7 @@ class Book // ... #[ApiProperty( - types: ['https://schema.org/name'], + iris: ['https://schema.org/name'], jsonldContext: [ '@id' => 'http://yourcustomid.com', '@type' => 'http://www.w3.org/2001/XMLSchema#string', @@ -61,7 +61,7 @@ The generated context will now have your custom attributes set: ``` Note that you do not have to provide the `@id` attribute. If you do not provide an `@id` attribute, -the value from `iri` will be used. +the value from `iris` will be used. ### Extending the Context of a Whole Resource diff --git a/core/external-vocabularies.md b/core/external-vocabularies.md index 5590013c312..eaf419b288a 100644 --- a/core/external-vocabularies.md +++ b/core/external-vocabularies.md @@ -20,13 +20,17 @@ class Book { // ... - #[ApiProperty(types: ['https://schema.org/name'])] + #[ApiProperty(iris: ['https://schema.org/name'])] public $name; // ... } ``` +On a property, `iris` sets the IRI used in the JSON-LD context and in the Hydra documentation. The +`types` option of `#[ApiProperty]` is only used as the `externalDocs` URL of the property in the +JSON Schema. + The generated JSON for products and the related context document will now use external IRIs according to the specified attributes: @@ -57,8 +61,8 @@ An extended list of existing open vocabularies is available on [the Linked Open Vocabularies (LOV) database](https://lov.linkeddata.es/dataset/lov/). By default, when using [validations](validation.md) API Platform 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]` attributes. +[Schema.org](https://schema.org) types for your properties (the `types` option, used in the JSON +Schema) if you did not provide any in your `#[ApiProperty]` attributes. - Symfony built-in mapping is: diff --git a/core/graphql.md b/core/graphql.md index 74b141c7dd7..8f7110a8d8e 100644 --- a/core/graphql.md +++ b/core/graphql.md @@ -3020,7 +3020,7 @@ class MediaObject #[ORM\Id, ORM\Column, ORM\GeneratedValue] protected ?int $id = null; - #[ApiProperty(types: ['https://schema.org/contentUrl'])] + #[ApiProperty(iris: ['https://schema.org/contentUrl'])] #[Groups(['media_object_read'])] public ?string $contentUrl = null; diff --git a/symfony/file-upload.md b/symfony/file-upload.md index 4e4c123eab5..29b36e3cab9 100644 --- a/symfony/file-upload.md +++ b/symfony/file-upload.md @@ -108,7 +108,7 @@ class MediaObject #[ORM\Id, ORM\Column, ORM\GeneratedValue] private ?int $id = null; - #[ApiProperty(types: ['https://schema.org/contentUrl'], writable: false)] + #[ApiProperty(iris: ['https://schema.org/contentUrl'], writable: false)] #[Groups(['media_object:read'])] public ?string $contentUrl = null; @@ -337,7 +337,7 @@ class Book #[ORM\ManyToOne(targetEntity: MediaObject::class)] #[ORM\JoinColumn(nullable: true)] - #[ApiProperty(types: ['https://schema.org/image'])] + #[ApiProperty(iris: ['https://schema.org/image'])] public ?MediaObject $image = null; // ... @@ -476,7 +476,7 @@ class Book { // ... - #[ApiProperty(types: ['https://schema.org/contentUrl'])] + #[ApiProperty(iris: ['https://schema.org/contentUrl'])] #[Groups(['book:read'])] public ?string $contentUrl = null;