Skip to content

fix(hydra): resolve collection member types from hydra:memberAssertion - #181

Open
vincentchalamon wants to merge 1 commit into
mainfrom
fix/hydra-member-assertion
Open

vincentchalamon wants to merge 1 commit into
mainfrom
fix/hydra-member-assertion

Conversation

@vincentchalamon

Copy link
Copy Markdown
Contributor

API Platform 5 describes the member type of an entrypoint collection with a hydra:memberAssertion (rdf:type ) instead of an owl:equivalentClass restriction on hydra:member, so findRelatedClass() no longer found the class and parsing failed:

Cannot find the class related to https://example.com/docs.jsonld#Entrypoint/book.

React Admin could therefore not introspect an API Platform 5 backend.

Q A
Branch? main
Tickets N/A
License MIT
Doc PR N/A

API Platform 5 describes the member type of an entrypoint collection with a
hydra:memberAssertion (rdf:type <Class>) instead of an owl:equivalentClass
restriction on hydra:member, so findRelatedClass() no longer found the class
and parsing failed:

    Cannot find the class related to https://example.com/docs.jsonld#Entrypoint/book.

React Admin could therefore not introspect an API Platform 5 backend.

Add memberAssertion as an extra strategy rather than a replacement: the
owl:equivalentClass branch is untouched, so 4.x backends keep working. The new
test converts the existing 4.x fixture to the 5.0 shape and asserts both
produce the same API.
@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 71.29% (🎯 70%) 303 / 425
🟢 Statements 71.26% (🎯 70%) 305 / 428
🟢 Functions 70.31% (🎯 70%) 45 / 64
🟢 Branches 60.44% (🎯 58%) 243 / 402
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/hydra/parseHydraDocumentation.ts 85.53% 79.25% 90.9% 85.53% 39, 69-71, 77, 85-87, 91-93, 121-127, 133, 140-142, 223, 229, 235, 246, 260, 283, 306-313, 374, 385-390, 471
Generated in workflow #322 for commit fb23f36 by the Vitest Coverage Report Action

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants