Validating my JSON Feed on every site build

Featured image for sharing metadata for article

Earlier today, I found that my site's JSON feed has been broken since Thursday afternoon. I like to ensure that my site has a pretty high uptime of functionality, so this kinda sucked.

This isn't as much of an issue because I don't believe many folks use my JSON feed, as I have a fully fledged h-feed and RSS feed, and JSON feed isn't as popular.

However, as mentioned in Re-enabling search on my static website, this JSON feed is actually to be used for my search functionality on the site. This is more of a problem because it leaves the site broken, and folks aren't able to find previous content on the site.

Since September I've had an issue to check whether the feed was valid JSON in my build pipeline, but I haven't yet actually done it because I didn't think it could be that bad, and it didn't break that often.

I have, now, resolved the issue by fixing the issue that caused it to break, adding a validation step to ensure the feed is well-formed and I've also added follow-up work to stop this specific issue happening again.

I now validate my feed by using a JSON schema of the feed that covers my compliance with the spec, as unfortunately I couldn't use the feedparser gem as it doesn't validate the feed format.

Going through and validating that it is a valid JSON Feed, rather than just checking it's valid JSON, has actually picked up on the fact that my JSON feed has never been correct, as it has retuned an invalid field date_modfied, not date_modified.

It's also shown I've had a number of duplicated tags on posts, so I've also looked at fixing it on my Micropub endpoint as well as picking it up on site builds.

At least I'm moving slowly towards a well-formed site, and regression-proofing these issues by automating the steps to catch breakages in the future!

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#indieweb #jsonfeed #www.jvt.me #nablopomo.

This post was filed under articles.

This post is part of the series nablopomo-2019.

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.