manton / JSONFeed

The JSONFeed.org website
Creative Commons Zero v1.0 Universal
940 stars 54 forks source link

Empty properties #35

Open sonicdoe opened 7 years ago

sonicdoe commented 7 years ago

Currently, https://micro.blog/feeds/manton.json includes the following item:

{
  "author": {
    "_microblog": {
      "username": "SciPhi"
    },
    "avatar": "http://www.gravatar.com/avatar/e59f6b41f418b9e6d37aad95db19ea7c?s=96",
    "name": "Phi.Sanders",
    "url": ""
  },
  "content_html": "<p>🔗 Mike Monteiro #μβ — <a href=\"https://twitter.com/monteiro/status/865270045806444544\">twitter.com/monteiro/…</a> </p>",
  "date_published": "2017-05-18T19:09:00+00:00",
  "id": "83721",
  "url": "http://SciPhi.micro.blog/2017/05/18/mike-monteiro-httpstwittercommonteirostatus.html"
}

As you can see, author.url is present but empty (and therefore not a valid URL). Is this considered valid according to the spec?

donohoe commented 7 years ago

If its not considered valid I'd argue it should be considered value.

The alternative is not to have author.url which would mean I'd always have to check to see if it exists before I could use it. Would love to avoid things like that

sonicdoe commented 7 years ago

I’d argue the opposite of what @donohoe is suggesting. Here’s why:

Specifying that author.url should be a valid URL (if it is present) would allow you to use it directly. If it is empty, you probably wouldn’t want to use it anyway; what good is <a href="">Jane Doe</a>?

Furthermore, the spec is already pretty clear about it being an optional property, therefore, you would have to check for presence anyway.