go-fed / activity

ActivityStreams & ActivityPub in golang, oh my!
BSD 3-Clause "New" or "Revised" License
702 stars 111 forks source link

Do not overwrite existing @context in serialization #113

Closed cjslep closed 4 years ago

cjslep commented 5 years ago

In util.go, I added a TODO about overwriting the existing @context if it exists.

Unfortunately we must live in a world where users of the library will attempt the very highly discouraged practice to side-load additional "unknown" fields and set portions of the @context already.

This improvement will also help future-proof the code if something like manual @context setting gets first-class support.

cjslep commented 4 years ago

I explored this and can safely say it breaks a lot of existing serialization/deserialization.

Since go-fed understands JSON-LD at code-generation time, there is no way to effectively merge two @context documents without re-building that understanding at code-compilation time.

Closing without solving.