ANF Validator: Catch Apple News Format Errors Before Apple Does

I built a small VS Code extension that checks Apple News Format article.json files while you work on them. It’s called ANF Validator, and it’s free on the Visual Studio Marketplace and on GitHub.

Here’s Seth Rubenstein this morning:

Seth and I worked together on Pew Research Center’s publishing platform, and Apple News is part of that pipeline. I built ANF Validator back in May while working on that with him. Apple’s News Preview app is the official way to check an article.json before it goes out. When it crashes, as it does for Seth on Golden Gate, you’re left guessing. ANF Validator won’t render the article for you, but it will tell you what’s wrong with the file, right in your editor.

What it checks

Open a folder that has an article.json in it and the extension switches on by itself. Errors go to the Problems panel with a line number and a note on how to fix them.

  • The schema. Required root fields (version, identifier, title, language, layout, components, componentTextStyles), field types, and formats such as the BCP 47 language code and the 64-character identifier limit. It’s checked against ANF 1.26.
  • Dangling references. A component can point at a textStyle, layout, or style by name. If that name isn’t in the root dictionary, Apple News won’t tell you nicely. ANF Validator flags it at the exact line.
  • Broken URLs. Image and media URLs get a quick HTTP check, so a 404 or 403 shows up as a warning before you publish. If you’re on a locked-down or offline network, turn it off with anfValidator.checkUrls.

It watches the file on disk, not only the editor. Most article.json files I deal with are generated by a build script or a CMS export, not typed by hand, so it re-validates whenever the file changes, whatever changed it.

Cursor, too

Seth uses Cursor, so it needed to be easy to install there. It runs in Cursor, Windsurf, and VSCodium. It’s on its way to Open VSX, where those editors get their extensions, so it’ll show up in the Extensions panel soon. Until then, grab the .vsix from the v0.1.0 release and use Extensions → … → Install from VSIX.

What it doesn’t do yet

The bundled schema covers the fields and components people actually use, not every corner of the spec. Unknown properties are allowed through, so you shouldn’t get false errors. If something valid gets flagged, open an issue. Validation also runs on save, not on every keystroke.

If you publish to Apple News, give it a try and let me know what breaks.


Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.