Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/aurelienbobenrieth/gadget/llms.txt

Use this file to discover all available pages before exploring further.

This rule enforces that the actionType property in model action options is set to one of the valid values: create, update, delete, or custom. Invalid action types will cause runtime errors in Gadget.

Rule Details

This rule checks the actionType property in model action options and reports an error if the value is not one of the supported types. Valid action types:
  • "create"
  • "update"
  • "delete"
  • "custom"
Severity: Error Auto-fixable: No

Examples

Incorrect

// Invalid type: scheduler
export const options: ActionOptions = {
  actionType: "scheduler"
};

// Invalid type: read
export const options: ActionOptions = {
  actionType: "read"
};

// Invalid type: unknown
export const options: ActionOptions = {
  actionType: "unknown"
};

// Empty string
export const options: ActionOptions = {
  actionType: ""
};

Correct

// Valid create action type
export const options: ActionOptions = {
  actionType: "create"
};

// Valid update action type
export const options: ActionOptions = {
  actionType: "update"
};

// Valid delete action type
export const options: ActionOptions = {
  actionType: "delete"
};

// Valid custom action type
export const options: ActionOptions = {
  actionType: "custom"
};

// No actionType property (allowed)
export const options: ActionOptions = {
  returnType: true
};
This rule only applies to model actions (files in api/models/*/actions/). Global actions should not have an actionType property at all.

When to Use

This rule is included in the recommended config and should always be enabled for Gadget projects. It prevents runtime errors by catching invalid action types at development time.

Build docs developers (and LLMs) love