Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
We Distribute
  1. Home
  2. Technical Discussion
  3. NodeBB <> Lemmy federation issue (re: nullable image/icon)

NodeBB <> Lemmy federation issue (re: nullable image/icon)

Scheduled Pinned Locked Moved Technical Discussion
lemmynodebbactivitypub
26 Posts 4 Posters 804 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • evan@cosocial.caE evan@cosocial.ca

    @julian @nutomic null values are bad in JSON-LD. We really have to avoid them. There are some bad references to `null` in the AP spec; they're likely to get removed sometime soon.

    julian@activitypub.spaceJ This user is from outside of this forum
    julian@activitypub.spaceJ This user is from outside of this forum
    julian@activitypub.space
    wrote on last edited by
    #3

    evan@cosocial.ca I had no idea that was the case. That is very good to know and having it called out in some sort of best practices doc (an existing w3c explainer?) would be helpful 😄

    1 Reply Last reply
    1
    • julian@activitypub.spaceJ This user is from outside of this forum
      julian@activitypub.spaceJ This user is from outside of this forum
      julian@activitypub.space
      wrote on last edited by
      #4

      NodeBB v4.6.1 contains the fix so that if an avatar and cover photo are not set, they are not included in the ActivityPub actor data.

      1 Reply Last reply
      0
      • trwnh@mastodon.socialT This user is from outside of this forum
        trwnh@mastodon.socialT This user is from outside of this forum
        trwnh@mastodon.social
        wrote on last edited by
        #5

        @julian @evan aside from potentially causing null pointer exceptions when you try to dereference null, using null is equivalent to just leaving out the statement in the first place. there's no reason to use null. the only time you'd need null values is if your schema required a certain key to be present but allowed the value to be nullable, which is generally a bad idea compared to just making the key optional. tony hoare, the inventor of null, called it their "billion-dollar mistake".

        julian@activitypub.spaceJ 1 Reply Last reply
        0
        • trwnh@mastodon.socialT trwnh@mastodon.social

          @julian @evan aside from potentially causing null pointer exceptions when you try to dereference null, using null is equivalent to just leaving out the statement in the first place. there's no reason to use null. the only time you'd need null values is if your schema required a certain key to be present but allowed the value to be nullable, which is generally a bad idea compared to just making the key optional. tony hoare, the inventor of null, called it their "billion-dollar mistake".

          julian@activitypub.spaceJ This user is from outside of this forum
          julian@activitypub.spaceJ This user is from outside of this forum
          julian@activitypub.space
          wrote on last edited by
          #6

          trwnh@mastodon.social said in NodeBB <> Lemmy federation issue (re: nullable image/icon):
          > using null is equivalent to just leaving out the statement in the first place.

          That's not true, there are specific scenarios where having an explicit "no value" is significant vs "missing value"...

          1 Reply Last reply
          0
          • evan@cosocial.caE This user is from outside of this forum
            evan@cosocial.caE This user is from outside of this forum
            evan@cosocial.ca
            wrote on last edited by
            #7

            @julian @trwnh i there are specifically processing problems with JSON-LD when an `id` property is `null`. I agree, we need better guidance. I'm adding an issue for it.

            Link Preview Image
            null values · Issue #656 · w3c/activitystreams

            When is null an ok value? What does it signify.

            favicon

            GitHub (github.com)

            1 Reply Last reply
            0
            • trwnh@mastodon.socialT This user is from outside of this forum
              trwnh@mastodon.socialT This user is from outside of this forum
              trwnh@mastodon.social
              wrote on last edited by
              #8

              @julian if you give me any specific examples of when you would want to use null, i can recommend better alternatives. generally, it's always possible that there is missing information.

              julian@activitypub.spaceJ 2 Replies Last reply
              0
              • liaizon@social.wake.stL This user is from outside of this forum
                liaizon@social.wake.stL This user is from outside of this forum
                liaizon@social.wake.st
                wrote on last edited by
                #9

                @julian love to see the reports of cross project colab!

                1 Reply Last reply
                1
                • trwnh@mastodon.socialT trwnh@mastodon.social

                  @julian if you give me any specific examples of when you would want to use null, i can recommend better alternatives. generally, it's always possible that there is missing information.

                  julian@activitypub.spaceJ This user is from outside of this forum
                  julian@activitypub.spaceJ This user is from outside of this forum
                  julian@activitypub.space
                  wrote on last edited by julian@activitypub.space
                  #10

                  trwnh@mastodon.social found one.

                  NodeBB uses audience to denote which audience an object (or context) belongs to.

                  Posts and Topics in NodeBB can belong to no context at all. null would be the way to communicate this, since omission might mean one isn't specified.

                  Likewise, a Move(Context) where a topic is moved out of a category but not into another. You probably shouldnt omit target there.

                  1 Reply Last reply
                  0
                  • trwnh@mastodon.socialT This user is from outside of this forum
                    trwnh@mastodon.socialT This user is from outside of this forum
                    trwnh@mastodon.social
                    wrote on last edited by
                    #11

                    @julian no, null is the same as nothing. what you want is more like [] (the empty set). in the case where you Move something without a target, you should be sending an Update instead.

                    trwnh@mastodon.socialT 1 Reply Last reply
                    0
                    • trwnh@mastodon.socialT trwnh@mastodon.social

                      @julian no, null is the same as nothing. what you want is more like [] (the empty set). in the case where you Move something without a target, you should be sending an Update instead.

                      trwnh@mastodon.socialT This user is from outside of this forum
                      trwnh@mastodon.socialT This user is from outside of this forum
                      trwnh@mastodon.social
                      wrote on last edited by
                      #12

                      @julian but more generally my question is, what practical application would you need to make use of an empty set []? like, a consumer encountering a value should do A, encountering a null or missing property should do B, encountering an empty set should do C... what is the difference between B and C?

                      julian@activitypub.spaceJ 1 Reply Last reply
                      0
                      • trwnh@mastodon.socialT trwnh@mastodon.social

                        @julian but more generally my question is, what practical application would you need to make use of an empty set []? like, a consumer encountering a value should do A, encountering a null or missing property should do B, encountering an empty set should do C... what is the difference between B and C?

                        julian@activitypub.spaceJ This user is from outside of this forum
                        julian@activitypub.spaceJ This user is from outside of this forum
                        julian@activitypub.space
                        wrote on last edited by
                        #13

                        trwnh@mastodon.social receiving a Move(Context) where target is null would tell NodeBB to move the topic to -1, uncategorized.

                        For those not supporting the catch-all bucket, deleting the context is ok too.

                        1 Reply Last reply
                        0
                        • trwnh@mastodon.socialT This user is from outside of this forum
                          trwnh@mastodon.socialT This user is from outside of this forum
                          trwnh@mastodon.social
                          wrote on last edited by
                          #14

                          @julian so this is still in effect a Remove or Update, not a Move. if you wanted it to be a Move, you would instead have an "uncategorized" category whose id is /categories/-1 or something like that.

                          1 Reply Last reply
                          0
                          • trwnh@mastodon.socialT trwnh@mastodon.social

                            @julian if you give me any specific examples of when you would want to use null, i can recommend better alternatives. generally, it's always possible that there is missing information.

                            julian@activitypub.spaceJ This user is from outside of this forum
                            julian@activitypub.spaceJ This user is from outside of this forum
                            julian@activitypub.space
                            wrote on last edited by
                            #15

                            trwnh@mastodon.social oh, another one.

                            Glitch-soc apparently lets you hide follower counts, and federates a -1. That works but null would be a more explicit statement that the follower collection is hidden/not accessible.

                            1 Reply Last reply
                            0
                            • trwnh@mastodon.socialT This user is from outside of this forum
                              trwnh@mastodon.socialT This user is from outside of this forum
                              trwnh@mastodon.social
                              wrote on last edited by
                              #16

                              @julian leaving out the totalItems statement entirely would do the same thing. the problem is when you ignore the (lack of) information presented and synthesize your own.

                              you could also define a vocab term for "hidden" or "unavailable", although this isn't much better than leaving it out in the first place

                              julian@activitypub.spaceJ 1 Reply Last reply
                              0
                              • trwnh@mastodon.socialT trwnh@mastodon.social

                                @julian leaving out the totalItems statement entirely would do the same thing. the problem is when you ignore the (lack of) information presented and synthesize your own.

                                you could also define a vocab term for "hidden" or "unavailable", although this isn't much better than leaving it out in the first place

                                julian@activitypub.spaceJ This user is from outside of this forum
                                julian@activitypub.spaceJ This user is from outside of this forum
                                julian@activitypub.space
                                wrote on last edited by
                                #17

                                trwnh@mastodon.social leaving out totalitems is absolutely not the same as explicitly declaring a null value. You don't know whether the implementation just didn't send totalItems or whether it was omitted on purpose.

                                1 Reply Last reply
                                0
                                • trwnh@mastodon.socialT This user is from outside of this forum
                                  trwnh@mastodon.socialT This user is from outside of this forum
                                  trwnh@mastodon.social
                                  wrote on last edited by
                                  #18

                                  @julian what's the difference between "not sending" vs "omitting"? those are synonyms

                                  julian@activitypub.spaceJ 1 Reply Last reply
                                  0
                                  • trwnh@mastodon.socialT trwnh@mastodon.social

                                    @julian what's the difference between "not sending" vs "omitting"? those are synonyms

                                    julian@activitypub.spaceJ This user is from outside of this forum
                                    julian@activitypub.spaceJ This user is from outside of this forum
                                    julian@activitypub.space
                                    wrote on last edited by
                                    #19

                                    trwnh@mastodon.social not sent due to implementation differences, rather.

                                    1 Reply Last reply
                                    0
                                    • trwnh@mastodon.socialT This user is from outside of this forum
                                      trwnh@mastodon.socialT This user is from outside of this forum
                                      trwnh@mastodon.social
                                      wrote on last edited by
                                      #20

                                      @julian there's no difference on the consuming side (and in many programming languages you can check for truthiness with something like `if x.get("totalItems")` which defaults to returning null if missing anyway)

                                      functionally, you either have the information, or you don't

                                      julian@activitypub.spaceJ 1 Reply Last reply
                                      0
                                      • trwnh@mastodon.socialT trwnh@mastodon.social

                                        @julian there's no difference on the consuming side (and in many programming languages you can check for truthiness with something like `if x.get("totalItems")` which defaults to returning null if missing anyway)

                                        functionally, you either have the information, or you don't

                                        julian@activitypub.spaceJ This user is from outside of this forum
                                        julian@activitypub.spaceJ This user is from outside of this forum
                                        julian@activitypub.space
                                        wrote on last edited by
                                        #21

                                        trwnh@mastodon.social as someone working on the consuming side, that is not correct.

                                        If my AP lib automatically assumed null when requesting an object property that didn't exist I'd consider that a bug.

                                        1 Reply Last reply
                                        0
                                        • trwnh@mastodon.socialT This user is from outside of this forum
                                          trwnh@mastodon.socialT This user is from outside of this forum
                                          trwnh@mastodon.social
                                          wrote on last edited by
                                          #22

                                          @julian this wouldn't be your AP lib, it would be your programming language itself

                                          julian@activitypub.spaceJ 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          Powered by NodeBB Contributors
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups