NfNitLoop / feoblog

A distributed, cryptographically-verifiable blog / social network
Other
71 stars 4 forks source link

Item "Extension" type. #86

Open NfNitLoop opened 2 years ago

NfNitLoop commented 2 years ago

Add a freeform "extensions" field in the Item type so that third-party apps can add additional (meta)data to Items in an easily discoverable way.


There's nothing stopping someone from shoving more data into an Item as it is, since protobuf if designed to ignore fields it doesn't (yet) know about. But leaving it up to folks to choose how to do that will possibly lead to collisions, and also make it hard to discover how to parse the embedded data.

I'm thinking something like this:

message Item {
    // ...

    // A place for third-party clients to add any additional metadata they wish.
    // the string key is the name of your extension.
    // Ex: if you have a client called "Foo" and a feature called "Bar Baz", use the format:
    // "foo:bar-baz"
    // Or, you could just use an extension name for your client ("foo") and map 
    // its various values to message properties inside of that object:  
    map <string, AnyMessage> extensions = // ...
}

message AnyMessage {
    // This space left blank. You may specify any fields you wish in your extension.
}