SR016

Severity: error

Summary: primary key field is neither generated nor required

What this means

A field marked primary: true has neither generated: true nor required: true. Shaperail cannot determine how the primary key value will be provided — either the database generates it (UUID auto-generation) or the caller must supply it. One of the two must be declared explicitly.

Example that triggers this

resource: items
version: 1
schema:
  id: { type: uuid, primary: true }

How to fix it

Add generated: true (server-assigned) or required: true (caller-supplied) to the primary key field:

id: { type: uuid, primary: true, generated: true }

Back to top

Shaperail documentation lives in the same repository as the framework so every release has versioned instructions. See the latest release for the most recent version.

This site uses Just the Docs, a documentation theme for Jekyll.