Node check not throwing an error on invalid content

I have a very simple schema that roughly looks like this:

title block*

My intent is to force a custom node type title to be the first, mandatory element. However when I’m in the editor and remove the title, when I call Node.check on the doc nothing happens. Isn’t this supposed to throw an error?

The editor won’t let you remove the title if the schema requires it, so I think something else is going wrong here.

Good to know - will dig a bit deeper then, and get back when I find root cause.

So yeah - I’m using TipTap and still getting used to all of this, but basically what I thought was the schema that I constructed wasn’t actually the case. I now have a different setup where the schema (from a content expression) looks okay and the behavior that I’m seeing with a schema like this:

title block*

  1. passing <title>Hello</title><p>world</p> results in: <title>Hello</title><p>world</p>
  2. passing <p>Hello world</p> results in: <title>Hello world</title>
  3. passing “” results in: <title></title>
  4. passing in <title>Hello</title><p>world</p><title>domination</title> results in: <title>Hello</title><p>world</p><p>domination</p>

I believe this all is intended behavior right?

Looks all intended to me.

1 Like