#social 2019-04-08

2019-04-08 UTC
lolico joined the channel
#
lolico
Hello!
#
lolico
Is this activity pub IRC?
#
fr33domlover
o/ lolico, yeah this is a good place to discuss ActivityPub
#
lolico
Cool, I'm looking into the protocall. Any examples for php
#
fr33domlover
lolico, there's a variety of php implementations iirc. Some of them are PixelFed and Pterotype
#
fr33domlover
(Ah, also the Social application in Nextcloud)
#
lolico
Thank you
timbl joined the channel
#
jdormit[m]
lolico: I'm nearly finished with a PHP library implementimg ActivityPub - https://github.com/pterotype-project/activitypub-php
#
jdormit[m]
Contributions are welcome, the roadmap/project tracker is https://github.com/pterotype-project/activitypub-php/issues/5
#
jdormit[m]
What's your use case? I would love to see the library get used in more projects
naturzukunft, vitalyster, xmpp-social and timbl joined the channel
#
trwnh
question: can properties have a value of `null` or is this practically useless? would you ever expect an activity with `null` value(s)? would properties with a value of `null` get ignored?
#
trwnh
relevant: i'm messing around with a python library and wondering if i can't just define all valid properties with default value `null` then strip all properties that aren't defined later when generating the json representation
naturzukunft joined the channel
#
nightpool[m]
I can't remember whether null is a valid json-ld value or not
#
nightpool[m]
check the spec?
#
nightpool[m]
as2 says:
#
nightpool[m]
>When serialized, absent properties are represented by either (a) setting the property value to null, or (b) by omitting the property declaration altogether at the option of the publisher. These representations are semantically equivalent. If a property has an array value, the absence of any items in that array must be represented by omitting the property entirely or by setting the value to null. The appropriate interpretation of an omitted or
#
nightpool[m]
explicitly null value is that no value has been assigned as opposed to the view that the given value is empty or nil.
#
nightpool[m]
my guess is that there's probably a similar step in the json-ld compaction algorithm
#
nightpool[m]
trwnh: for the specific object-level python example though, I'm not sure why you can't just use a defaultdict or a default `__getattr__`
#
nightpool[m]
or use access methods that take a default value
#
trwnh
ok good i was interested in the "semantically equivalent" bit
#
trwnh
basically i wanted to know if it was safe to just strip null-values of accepted properties
#
trwnh
i haven't defined type hinting yet or anything like that, but it looks like i can go ahead with that basic design
#
cjslep[m]
An important exception is the C2S "Update" activity where nulls are significant and different than absent properties
#
cjslep[m]
Unfortunately this is an ActivityPub thing and i find a source of misery.
#
trwnh
cjslep[m]: well i think i can do special handling of partial Update in C2S, by literally taking the string "null" to mean the property should be removed. but outside of that, i see no issues
#
cjslep[m]
Others may not support a string value for all properties.
#
trwnh
like, i'm aliasing null = None for object properties but not for json. imo json should only be used as a repr and logic should be performed on the parsed objects
#
trwnh
cjslep[m]: i mean the string "null" will be present in the literal text of the json, so it can be parsed as a special exception in C2S processing
#
trwnh
i think it makes the most sense to take an extensible approach to trwnh/asap, to differentiate from dsblank/activitypub (which uses a Manager to construct its own API wrapper)
#
cjslep[m]
trwnh yes and I am saying such a special exception won't interoperate with other clients in C2S and other servers in C2S, only your clients and your servers.
#
trwnh
hmm
#
trwnh
i don't see why not
#
trwnh
a pure C2S approach would literally be sending the json text, right?
#
cjslep[m]
Because go-fed won't recognize a string "null" as a literal null in JSON so that client / go-fed server or go-fed client / that server will both be broken
#
cjslep[m]
I am for extensibility, too! but am being shown an interoperability problem :(
#
trwnh
cjslep[m]: i think you're mistaking what i'm saying. i mean returning null and not "null"
#
trwnh
so it's not dealing with a string, it's still a literal null
#
trwnh
it's just that, when parsing the JSON, i would check to see if it's a C2S Update, and then if so, have special handling logic
#
cjslep[m]
C2S protocol is the sending and receiving of JSON-encoded activities, yes.
#
cjslep[m]
Shhhh ok
#
cjslep[m]
Ahhh*
#
cjslep[m]
Sorry for the hassle.
#
cjslep[m]
Thanks for clarifying.
#
trwnh
yeah i meant when constructing an internal python object representation based on the parsed json
#
trwnh
and then when generating my own json
#
cjslep[m]
Yep, thanks for being patient with me!
vitalyster, cwebber2 and eprodrom joined the channel; vitalyster left the channel
#
decentral1se
/
timbl joined the channel