prongs
GitHub

request.invalid

A field breaks a rule: too long, the wrong format, out of range

Profile

Raised with

Status

422

Message

yours
Read https://www.prongs.dev/docs/intents/request/invalid.md and tell me whether request.invalid fits what I am building.

Example

TS
return fail('request.invalid', 'Use 1–32 lowercase letters, numbers, or hyphens.');
The caller gets
Terminal
HTTP 422

{
"ok": false,
"error": "Use 1–32 lowercase letters, numbers, or hyphens.",
"code": "request.invalid"
}

Connections

Choosing between neighbours

  • If it is

    Use

  • A field breaks a rule: too long, the wrong format, out of range

    request.invalid
  • A value that is fine on its own but clashes with existing data, like a taken handle

    conflict.duplicate
  • A readable request with a wrong value

    rather than request.malformed
    request.invalid
  • Anything the caller did wrong

    rather than failure.internal
    request.invalid

For registry authors

Starter intents. These are the intents prongs add errors puts in your registry, raised with fail(). Change the messages to suit your app, and the statuses through the status.* intents they are built from.

The entry prongs add errors writes into your registry. Change the message here, or the status through its status.* ref.

TS
'request.invalid': {
kind: 'semantic',
description: 'A field breaks a rule: too long, the wrong format, out of range',
refs: ['status.unprocessable'],
keywords: ['validation', 'invalid', 'too long', 'format'],
notFor: [
{
context: 'a value that is fine on its own but clashes with existing data, like a taken handle',
instead: 'conflict.duplicate',
},
],
binding: { publicMessage: 'Check what you entered.' },
},