SR012

Severity: error

Summary: ref on non-uuid field

What this means

A field has a ref: attribute pointing to another resource’s field, but its type is not uuid. Foreign key references must always be UUIDs to match the primary key type Shaperail generates for referenced resources.

Example that triggers this

resource: items
version: 1
schema:
  id:     { type: uuid, primary: true, generated: true }
  org_id: { type: string, ref: organizations.id }

How to fix it

Change the field type to uuid:

org_id: { type: uuid, ref: organizations.id, required: 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.