Skip to content

docs: clarify property iris versus types - #2347

Open
soyuka wants to merge 1 commit into
api-platform:4.4from
soyuka:docs/external-vocabularies-iris-vs-types
Open

soyuka wants to merge 1 commit into
api-platform:4.4from
soyuka:docs/external-vocabularies-iris-vs-types

Conversation

@soyuka

@soyuka soyuka commented Sep 23, 2026

Copy link
Copy Markdown
Member

The example on this page declared #[ApiProperty(types: ['https://schema.org/name'])] and then showed a JSON-LD @context mapping name to that IRI. That output only ever comes from iris.

Verified on api-platform/core branch 4.4:

  • iris on a property is read at src/JsonLd/ContextBuilder.php:200 for the @context and at src/Hydra/Serializer/DocumentationNormalizer.php:582 for the Hydra documentation. Without it, both fall back to a local term built from the short name.
  • types on a property has exactly one consumer, externalDocs.url in src/JsonSchema/Metadata/Property/Factory/SchemaPropertyMetadataFactory.php:120. It reaches no RDF output.
  • types on a resource does work as documented: src/JsonLd/Serializer/ItemNormalizer.php:159 for the @type, src/Hydra/Serializer/DocumentationNormalizer.php:155 for subClassOf.

This fixes the example and adds a short section naming which attribute drives which output.

Closes api-platform/core#7051

The example on this page used `ApiProperty(types:)` on a property and
then showed a JSON-LD `@context` that only `iris` produces. Property
`types` reaches no RDF output at all: its only consumer is the
`externalDocs.url` field of the generated OpenAPI schema.

Fixes the example and adds a section stating which attribute drives
which output.

Closes api-platform/core#7051

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant