Skip to content

OPEN-49

One status test for refusals: 400 unreadable, 413 too large, 415 wrong media type, 422 read but refused.

What was open

The specification drew two lines for the same kind of refusal. STORE-1, API-1, STORE-2, MAN-20 and INT-19 answered 400 for any body refused before workflow rules ran, while VAL-LAUNCH, STORE-5, STORE-9 and MAN-20's validation answered 422 for content that failed. API-2 required a turn to judge inputs exactly as a launch does, yet answered 400 where a launch answered 422. MAN-13, MAN-15 and MAN-19 named no status at all, and MAN-19's refusal had no code a client could recognise (API-8). Nothing said which status a missing or unsupported Content-Type gets, or whether a refusal that reads a workflow's inputs may answer before the caller is authorised.

Decision

One test decides the status of every refusal, stated once in the conventions and applied by every rule that names a status, as RFC 9110 defines the codes. A body sent with no Content-Type or an unsupported one is refused with 415, whatever it holds. A body over the size limit is refused with 413, and may be refused without being read whole. A body from which no JSON value could be read within the limits (empty, not well-formed, or nested at or beyond the depth limit) is refused with 400. Depth goes with 400 because an implementation may stop reading at the depth limit, often inside its parser, and so cannot always tell a body nested too deep from a broken one; the rule says so. A JSON value that was read and is refused is refused with 422: a scalar top level, a missing, empty or too long name, an interface entry with two bindings, a callback without value, refused launch or turn inputs, validation failures and import gates. A malformed query parameter stays 400 (STORE-15), and out-of-range paging is still never refused (API-6). The body gate's refusals carry codes, as API-8 requires of every refusal: UNSUPPORTED_MEDIA_TYPE (415), REQUEST_BODY_TOO_LARGE (413) and INVALID_REQUEST_BODY (400, and 422 for a scalar top level). MAN-19's refusal is 422 with the code ASYNC_DECLARED. Checks of the body alone may run before authorisation; checks against stored state (launch and turn inputs, validation) must run after it, so a 422 never tells a caller who may not see a workflow anything about its inputs. INT-19 keeps refusing a missing value before it looks the interrupt up, which reads no stored state. Existing error codes keep their meaning (API-8): only the status changes. Two clauses of MAN-20 that a folded line had split (x-data- type, author- written) are rejoined while the rule is rewrapped. The test covers the request itself (body, query and headers, a malformed header a rule defines being 400); 403, 404 and 409 come from their own rules. A check that reads stored state runs after authorisation whatever status it would give, not only when it gives 422. An absent body is zero-length content sent to an endpoint whose body is optional; it is mapped to an empty object whatever its Content-Type, and STORE-1's 400 for an empty body applies only where a body is required. application/json with parameters such as charset=utf-8 counts as application/json. MAN-19 says that how a launch requests a synchronous wait is implementation-defined until a rule defines it (DEFERRED.md). Every refusal these rules name now carries a code (API-8). The conventions give a default code per row of the status table and for 403 (ACCESS_DENIED) and 404 (NOT_FOUND), and name three recurring 422 codes: INVALID_REQUEST_BODY for a refused shape or member, INVALID_INPUTS for launch and turn inputs (API-2, MAN-13, MAN-15) and VALIDATION_FAILED for workflow validation (STORE-5, VAL-LAUNCH, STORE-9, MAN-20). Rules that distinguish cases name their own: WORKFLOW_ID_TAKEN (STORE-3, STORE-9), SESSION_WITHOUT_WORKFLOW (API-3), UNSUPPORTED_BUNDLE_FORMAT, UNTRUSTED_PUBLISHER, MISSING_PROCESSOR and INVALID_FLOW_ID (STORE-9, which now also gives the flow-id refusal its status, 422), and INVALID_QUERY_PARAMETER (STORE-15). INT-19 refuses a caller without callback authority with 403 ACCESS_DENIED, and a missing value with INVALID_REQUEST_BODY. A failure that cannot be attributed (API-7) carries INTERNAL_ERROR.

Rules affected