Add safeguards around Unknown annotations and unhandled annotations in renderers
Closed this issue · 1 comments
tim-evans commented
As per a discussion that we had here, we were finding that it's particularly annoying when unknown annotations occur, and when Rendering cases aren't handled.
Unknown annotations are created automatically by atjson, and we'd like to make this an explicit decision by the user, because often this is not intentional and causes bugs.
Sussing out what to do about this structurally will take some time, but for now, we'd like to do the following:
- Add assertions when encountering any
UnknownAnnotation
in a Renderer. - Add warnings when a Renderer doesn't have a rendering hook for a given annotation. Having no render method for an annotation is undefined behavior by atjson, and is also different for each renderer. This logging will improve introspection for applications that use
@atjson/renderer-react
.
We expect that these will make the ergonomics of rendering and converting a bit easier.
tim-evans commented
This is fixed! 🎉