core icon indicating copy to clipboard operation
core copied to clipboard

How to remove hydra prefix?

Open taviani opened this issue 7 years ago • 6 comments

Hello everyone,

Is it possible to remove the hydra prefix (hydra:key) so we don't have an invalid character when parsing? (ie. the colon ':')

"hydra:member" would be "member" "hydra:view" would be "view" etc.

Any idea on how to do that? The serialization doc doesn't seem to cover that part.

taviani avatar Jun 09 '18 14:06 taviani

@taviani , did you discovered how to do that?

VBobCat avatar Apr 07 '21 15:04 VBobCat

https://github.com/HydraCG/Specifications/pull/151 https://lists.w3.org/Archives/Public/public-hydra-logs/2017Nov/0099.html

We could probably add an option, wdyt @dunglas ?

soyuka avatar Mar 11 '24 14:03 soyuka

Ok, let's add an option to remove the prefix, deprecate not setting it, and default to no prefix on v4 then!

JS devs will love this change.

dunglas avatar Mar 11 '24 14:03 dunglas

I'm not sure that not having a prefix should be the default.

soyuka avatar Mar 11 '24 16:03 soyuka

https://www.hydra-cg.com/spec/latest/core/ - none of their examples show it, which when I was first trying out api-platform made me think that api-platform didn't conform to the spec. It's probably more expected to not have it, than to have it.

nesl247 avatar Mar 11 '24 18:03 nesl247

@nesl247 examples in the spec used to use the hydra prefix but they changed after API Platform initial release.

Both representations are perfectly valid (a JSON-LD parser will understand them as exactly the same document), but I agree that being in sync with the spec will help newcomers understanding how Hydra works, and will hide the fact that API Platform uses Hydra for JS devs who don't care 😂

So I'm also in favor of removing the prefix by default in v4.

dunglas avatar Mar 11 '24 21:03 dunglas