lo48576 / _rustivitypub_old1

I decided to discard this and write another one from scratch.
10 stars 0 forks source link

Hello! - Knowledge Sharing #1

Open BanjoFox opened 6 years ago

BanjoFox commented 6 years ago

Hi there!

While looking for existing resources for my project (Aardwolf, also on GitHub), and I found this. It is very exciting to see other people working on ActivityPub for rust :)

I also just saw this Gist: An attempt at representing ActivityPub in Rust https://gist.github.com/wezm/65e416619f7c4b1e7a510b169426068d

Perhaps we can all share ideas :)

Cheers!

Banjo

lo48576 commented 6 years ago

Hello. I'm also excited to know Rustaceans interested in ActivityPub! Sorry for my poor English.

JSON views

I have chosen to implement "views" over (around?) raw json objects, not to implement structs to represent ActivityPub objects directly (like your link https://gist.github.com/wezm/65e416619f7c4b1e7a510b169426068d#file-activitypub-rs-L134 does). (Example: https://github.com/lo48576/rustivitypub/blob/0660d96c713420d4875d540161aa8e7e5e9e78fa/rustivitypub/src/document/view/link.rs) The reasons is below:

Goals of rustivitypub

I want my ActivityPub library to do:

My future plan

I was reckless to write this library without no preparation. I will rewrite almost all of the codes (but the core design might not change a lot).

I am currently busy with my private tasks (at least until Feb 2018), but preparing libraries to support writing this (opaque_typedef is one of them, it will make it easy to implement wrapper types).

As you can see in link.rs and property.rs, current codes are full of boilerplates and I'm tired of writing such codes. I feel that I should write them with macro or automated code generation.

One possible way:

declare_properties! {
    ("href", href, Iri),
    ("hreflang", hreflang, LanguageTag),
    ("mediaType", media_type, MediaType),
    ...
}
declare_views! {
    LinkView(href, hreflang, media_type, ...),
    ...
}

I will implement things above after I get free, but I am not sure this is good direction. I want to see many different designs of people and compare them.

BanjoFox commented 6 years ago

I would say that your English is pretty good :) Growing up we had a lot of foreign exchange students so I have learned how to interact with non-native speakers.

My project specifically is here: https://github.com/BanjoFox/Aardwolf/

So far it looks as though you have a pretty good plan in place, and I would like to spread more word about your project.

Have you seen the ActivityPub implementations test suite? https://test.activitypub.rocks/

lo48576 commented 6 years ago

Yes, I know it but I'd never used it. I am writing codes by referring to W3C specs, and I'm going to use test suite when the implementation become practical.

When I am unsure about some point (especially at data schema), I observe Mastodon's response by curl -H 'Accept: application/ld+json; profile="https://www.w3.org/ns/activitystreams"' https://mastodon.example.com/@exampleuser | jq . ;-)