Input validation matrix for every mutating endpoint
Use this matrix when a builder changes a create or update payload. It compares the frontend payload and its validators with the backend rules documented in this pack, names each missing type, required field, enum, and length check, and states the schema fix to ship in the backend in a separate reviewed change. It adds no new field and it changes no sign in, role, or tenancy rule.
Scope and method
Read this section first. It states what counts as a mutating endpoint in this pack and what this page does not invent.
- One real mutating endpoint is defined and consumed in this pack. It is POST /api/public/request, sent by public site code for the demo form and the question form on the request demo page. GET /api/health and GET /api/readiness are reads and are out of scope for this matrix.
- No backend source file for that endpoint is included in this pack. A backend check below marked as documented means the APPKIT sample, the api responses page, or the api validation guide states the rule. A backend check marked as missing means no endpoint specific rule is stated in the pack and must not be assumed.
- Seven further resources are listed in the api validation guide with field rules. The pack states no backend endpoint for those resources. Matrix C covers those resources so a future backend does not copy a guide row as if it were a shipped endpoint.
- Frontend evidence is the shipped validator in public site code, the shipped validator in the request demo page, and the shipped field limits on the saved answer and offline pages. Where the two request form validators differ, the row states the difference.
- Every fix below keeps the limits already shipped on the page. No fix adds a field, renames a field, widens a limit, or adds a new cap in this page.
Matrix A: POST /api/public/request
The body is JSON sent with Content-Type application/json and an X-Request-Id header. A successful send keeps the existing 204 with no body exception where the route already returns 204, and that exception is not converted to JSON in the same change that changes validation.
| Field | Wire type and required | Enum, length, and pattern | Frontend check | Backend check in pack | Gap and ready schema fix |
|---|---|---|---|---|---|
| name | String, required, trimmed before checks | 1 to 120 characters. Single line. No control characters. | Both validators check required, the 120 limit, the single line control rule, and that the field is present. The request demo validator also reads the required attribute. Site code checks required for every present field. | Missing. APPKIT states a missing required field is a 400 checked with str before SQL. No endpoint row states the 120 limit. | Backend string type, required, trim, then reject empty and reject over 120. Reject a non string, including a number, boolean, array, object, or null, as a validation error. No coercion. |
| String, required, trimmed before checks | 1 to 254 characters. Single line. No control characters. One at sign with text on both sides and a dot in the part after the at sign, as shipped in both validators. | Both validators check required, the 254 limit, the single line control rule, and that pattern. Neither validator trims an inner space. | Missing. No endpoint row states the 254 limit or that pattern. | Backend string type, required, trim, then reject empty, reject over 254, reject control characters, then apply the same pattern as the shipped validators. Do not add a second pattern in the backend. | |
| org | String, required, trimmed before checks | 1 to 200 characters. Single line. No control characters. | Both validators check required, the 200 limit, and the single line control rule. | Missing. No endpoint row states the 200 limit. | Backend string type, required, trim, then reject empty and reject over 200. Reject a non string. No coercion. |
| role | String, required, trimmed before checks | Enum only. College administrator, System office governance staff, IT staff, Faculty, Student services staff, Help desk staff, Student, Prospective student, Other. No free text length is listed for this field in either validator. | Both validators check that the value is in the enum and that it matches a choice shown in the select. Site code also checks the shipped option list. The request demo validator states the same nine values. | Missing. No endpoint row states the enum. A free text role would pass a length only check. | Backend string type, required, then enum check against the nine values above before any length check. Reject any other value, including a value with different case or extra space after trimming. Do not accept a role from a different list. |
| message | String, required, trimmed before checks | 1 to 4000 characters. Tab, line break, and carriage return are allowed. Other control characters are rejected. | Both validators check required, the 4000 limit, and that control rule. Both treat a blank message as required. | Missing. No endpoint row states the 4000 limit or that control rule. | Backend string type, required, trim for the required and length checks, then reject over 4000 and reject control characters other than tab, line break, and carriage return. Keep the stored text as sent after trimming ends. |
| kind | String, required, sent by site code from the form kind | Enum only. demo or question. | Both validators check the form kind against demo or question before sending. Site code then writes kind from the same form attribute. A person cannot type this field in the form. | Missing. No endpoint row states kind. The api validation guide lists kind only for a different resource. | Backend string type, required, then enum check demo or question. Reject any other value. Do not read kind from a form field name and do not default a missing kind to demo. |
| page | String, required, sent by site code from the page address | Must start with a slash. No length, pattern, or allowlist is stated in either validator. | Neither validator checks page. Site code sends the current page path as sent by the browser. The request demo page sends its own address. | Missing. No type, required, or length rule is stated. | Backend string type, required, then reject a value that does not start with a slash or that holds control characters. Record page as sent. Do not add a new allowlist or a new length cap in the validation change. If an allowlist is wanted, ship it as its own reviewed change with the page list. |
| website | String, optional, honeypot field sent by site code | No type, length, or pattern is stated in either validator. The field has no label and is hidden from people. | Neither validator checks website. Site code sends the field value as sent, without trimming. The request demo validator skips the field in its own check. | Missing. The api validation guide would reject an unknown field, yet site code sends website on every request. A strict unknown field check against the five form fields would reject every legitimate send. | Backend allowlist must name website as an allowed optional string field, separate from the five form fields, checked for string type and control characters only. Do not store website as a form answer. Do not reject website as unknown. Do not add a new length cap in the validation change. |
| X-Request-Id header | String header, required for a retry to reuse the same reference | No format, length, or pattern is stated in either validator. Site code creates a random identifier when the payload changes and reuses it when the payload is unchanged. | Site code sends the header on every attempt. Neither validator checks the header. The request demo validator does not send a header. | Missing. No header rule is stated. The api validation guide states a duplicate id returns 409 for a different resource, which must not be copied to this endpoint where a retry reuses an id on purpose. | Backend string type for the header when present, reject control characters, and treat a retry with the same header and the same field values as the same request, not as a duplicate create. Do not return 409 for a retry that reuses the reference. Do not create a new format rule in the validation change. |
Unknown field rule for this endpoint. The allowed body fields are name, email, org, role, message, kind, page, and website only. Any other field name in the JSON body is rejected as an unknown field. A duplicate field name in the raw JSON is rejected as malformed JSON. A body that is not valid JSON, or a request with the wrong content type, is rejected as malformed JSON. None of those three cases is checked by either frontend validator, because a browser form cannot send them.
Matrix B: status and error shape for this endpoint
Two shapes are documented in this pack for a validation failure. This endpoint must use the shape its shipped client already reads.
| Shape | Where it appears | Fix for this endpoint |
|---|---|---|
| Status 400, code validation_error, error as a plain string sentence, no data field on error | APPKIT response section and the api responses page. Site code reads a plain string, and also reads a nested message form on read. | Use this shape for every validation failure on POST /api/public/request. Status 400 for malformed JSON, unknown field, missing required field, wrong type, enum failure, pattern failure, control character failure, and length failure. Keep error as a plain string that tells the person what to do. Add code only as an extra field. Do not return 422 for this endpoint in the same change. |
| Status 400 invalid_json or unknown_field, status 422 required or invalid_type or too_long or out_of_range, status 409 duplicate, body as an error object with code, field, message, and a sorted fields list | Api validation guide, response rules table. That guide also states no backend endpoint is defined in the pack for its listed resources. | Do not copy that nested shape to POST /api/public/request in the validation change. Site code already accepts a nested message on read, so a future signed in endpoint may use the nested shape only after its client is checked against it. For this endpoint, map each guide row to 400 validation_error with the field named in the plain string. |
| Status 204 with no body on success where the route already returns 204 | APPKIT exception and site code form handling. Site code hides the form and shows a confirmation on 204. | Keep 204 with no body. Do not convert a 204 route to JSON in the validation change. A validation change and a status change ship in separate reviewed changes. |
Matrix C: documented resources with no backend in the pack
Each row compares the api validation guide rule with the validator shipped in this pack. A row marked no backend must not be shipped as a backend endpoint by copying the guide row alone.
| Resource | Guide rule | Shipped frontend validator in pack | Gap and fix |
|---|---|---|---|
| Saved answer | Title 1 to 200, question 1 to 2000, collectionId 1 to 120 required. Optional answer to 4000, sourceTitle to 200, sourceLink to 500, lastChecked to 80, workspace to 120, assistant to 120. Source link must start with http or https. Duplicate key title plus question plus sourceLink plus workspace plus assistant returns 409. | My Answers requires title only. Question and answer may be empty. Collection is chosen from a list with a default. Source link must start with http or https when present. A duplicate check uses title, question, sourceLink, workspace, and assistant. | A backend that requires question would reject saves the shipped page accepts with an empty question. Fix the guide row or the page check in one change so question required status matches. Keep collectionId as a list value, not as free text. Keep the duplicate key as paired strings after trimming. |
| Share copy and import file | Title 1 to 200 required. Source link must start with https only. Saved date must be a real calendar date in YYYY-MM-DD form. | Saved answer pages accept http or https for a source link. Last checked date is free text to 80 characters on My Answers and is not checked as a calendar date. | Http against https only is a direct conflict. Fix the guide to http or https to match the shipped pages, or change every shipped page in the same change. Keep last checked date as free text where the page shows it as text, and apply a calendar date check only to a field that is labelled as a date. |
| Canonical eligibility record | College, assistant, topic, and sourceTitle each 1 to 120 or 200, plus six condition fields with enum yes or no only. Result is server computed and never accepted from the client. | No form for this record is shipped in this pack. No validator can be compared. | Mark this row as no frontend and no backend in the pack. A future form must send the six conditions as strings yes or no with no other field, and the backend must reject a client sent result as an unknown field. |
| Role first run progress | College 1 to 120, role enum visitor, student, instructor, admin, checked object with at most 5 keys, each value boolean true, timestamps in ISO 8601 UTC with Z. | No form for this record is shipped in this pack. Role names in the request form are a different enum and must not be reused here. | Keep the two role enums separate. Reject a number or a string in place of a boolean true. Reject a timestamp without Z as a type failure. Do not accept a sixth checked key. |
| Weekly quality outcome | Event enum campus feedback given, campus answer shown, campus guide search performed. One event specific enum field required. Week starting Monday in YYYY-MM-DD form. Workspace, assistant, and channel string or null to 120. Id 1 to 120 required and unique, duplicate returns 409. | No shipped form sends this record in this pack. Weekly pages in the pack are calculators that send nothing. | Mark this row as no frontend and no backend in the pack. A future sender must send exactly one event specific field and must reject a second event specific field as unknown for that event. Do not copy the 409 duplicate rule to POST /api/public/request retries. |
| Campaign attribution | Each utm field optional string to 120 with letters, digits, dot, underscore, or hyphen only. Source page 1 to 500 must start with a slash. Referrer origin enum same site, external, none. | No shipped form sends utm fields in this pack. Site code analytics send only allowlisted properties and send no field value from a form. | Mark this row as no frontend and no backend in the pack. Reject any field outside the six utm fields, source page, and referrer origin as unknown. Do not accept a full referrer address in place of the enum. |
| Collection | Name 1 to 80 on create, id 1 to 120 on update. Built in id unfiled cannot be renamed or deleted and returns 422 invalid type. | My Answers checks name required and to 80, checks a duplicate name in any case, and moves answers to the built in collection when a collection is deleted. No id field is sent on create. | Keep the built in collection protection, but return the plain string envelope with status 400 for this endpoint family in a future backend, not the guide nested shape. Keep the duplicate name check in the same change that adds a backend, so a rename cannot create a second collection with the same name in a different case. |
Ready schema fix for POST /api/public/request
Apply these steps in the backend in one reviewed change. Check every step before any SQL runs. Keep the existing 204 success path and keep error as a plain string.
Check content type and JSON first
Require Content-Type application/json. Reject malformed JSON and a duplicate field name in the raw JSON as a validation error. Reject a body that is not a JSON object.
Reject unknown fields and non string types
Allow only name, email, org, role, message, kind, page, and website in the body. Reject any other field name. Reject a number, boolean, array, object, or null for any allowed field. Treat a present null for a required field as missing. Do not coerce any type.
Trim, then check required, enum, pattern, control characters, and length in field order
Trim each string. Check name, email, org, role, message, and kind as required. Check role against the nine values and kind against demo or question. Check email against the shipped pattern. Check single line fields for control characters and message for control characters other than tab, line break, and carriage return. Then check name to 120, email to 254, org to 200, and message to 4000. Check page as a required string starting with a slash with no control characters. Check website as an optional string with no control characters and do not store it as an answer.
Check the header as an opaque reference
Read X-Request-Id as a string when present and reject control characters. A retry with the same header and the same trimmed field values reuses the same request and must not be treated as a duplicate create.
Return one shape and write nothing on failure
On any failure return status 400 with a plain string error naming the first failing field in the order name, email, org, role, message, kind, page, website, and with code validation_error as an extra field. Write no record on failure. On success keep the existing status and body rule for that route.
- Empty name, a role outside the nine values, an email without the shipped pattern, a message one character over 4000, a kind outside demo or question, a page without a leading slash, and an unknown field each return 400 validation_error with the field named in the plain string.
- A number sent as name, a null sent as email, a duplicate field name in raw JSON, and malformed JSON each return 400 validation_error. No partial record is written for any of those cases.
- A valid send with the same X-Request-Id and the same field values on retry does not create a second request. A valid send with a changed field value creates a new reference on the client and is treated as a new request on the backend.
- No error response contains a stack trace, a secret, question text from another workspace, or a full referrer address. Error text stays a plain string that site code can display directly.
Next guide
Keep form field wording consistent with these limits.