Registry
K

schema-validation

No description available

krishn4040 executions

  • Legacy
  • slate
Connect a repo
npx codemod schema-validation

This transformation involves modifying how a paragraph block type is handled in a schema-like structure by replacing its static configuration with a runtime validation function (isValidNode).

Before

ts
const schema = {
  blocks: {
    paragraph: {
      isVoid: false,
    },
  },
};

After

ts
const isValidNode = (node: Node) => {
  if (Element.isElement(node) && node.type === 'paragraph') {
    return node.children.every(child => Text.isText(child));
  }
  return true;
};

Ready to evolve your codebase?

Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.