fix(jsonld): check if docs enabled when generate vocab in context#5676
fix(jsonld): check if docs enabled when generate vocab in context#5676Romaixn wants to merge 3 commits intoapi-platform:3.1from
Conversation
|
This doesn't look good to me. RDF types are now wrong. Even if it's considered a best practice to use dereferenceable URI as types, it's not mandatory. RDF parsers will not even try to hit the URL. It's just a namespace. I would just keep things as-is. |
|
Alternatively, we could attempt to replace the Or we could assume that if we disable the documentation, we also disable the |
|
No, contexts must always exist according to the JSON-LD spec. The error is likely because the docs route doesn't exist in the Symfony router. IMHO we have two options:
IMHO option 2 is more correct and easier to implement. WDYT? |
|
I think you're right; the second option is the best. I will modify my PR accordingly, by enabling only the route to |
Always add jsonld version of doc to prevent route not found when getting context of resource
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Check if
enable_docsoption is enabled before adding@vocabin JSON-LD context to avoid error route not found.Transform this :
{ "@context": { "hydra": "http:\/\/www.w3.org\/ns\/hydra\/core#", "@vocab": "https:\/\/localhost\/docs.jsonld#", "isbn": "Book\/isbn", "title": "Book\/title", "description": "Book\/description", "author": "Book\/author", "publicationDate": "Book\/publicationDate", "reviews": "Book\/reviews", "cover": "Book\/cover", "archivedAt": "Book\/archivedAt" } }To this :
{ "@context": { "hydra": "http:\/\/www.w3.org\/ns\/hydra\/core#", "isbn": "Book\/isbn", "title": "Book\/title", "description": "Book\/description", "author": "Book\/author", "publicationDate": "Book\/publicationDate", "reviews": "Book\/reviews", "cover": "Book\/cover", "archivedAt": "Book\/archivedAt" } }