Skip to main content

AEROSIM-TS-16

Project task

Verify typed API input rejection

Automated API tests prove valid typed requests succeed and malformed or unsupported input is rejected through the normalized error boundary.

AEROSIM-TS-16Canonical ID TASK-0016
Verified flow state
Done
Owner
AeroSim Architecture and Delivery
Component
API Service — HTTP contract test harness
Repository
corp-v1-aerosim/corp-v1-aerosim

Delivery scope

Register a testable POST /contract-fixture route accepting ContractFixtureRequest {name:string,count:integer}, normalize Fastify schema failures, and exercise valid, missing, wrong-type, additional-property, malformed-JSON, and unsupported-media-type requests. Primary files: applications/api/src/routes/contract-fixture.ts, applications/api/src/http/validation-error.ts, applications/api/tests/http-contract-rejection.test.ts.

Implementation contract

Implementation artifacts

  • applications/api/src/routes/contract-fixture.ts
  • applications/api/src/http/validation-error.ts
  • applications/api/tests/http-contract-rejection.test.ts

Inputs

  • POST /contract-fixture JSON body with name and count
  • Content-Type request header and raw JSON bytes

Outputs

  • 200 ContractFixtureResponse {acceptedName,count} for a schema-valid body
  • 400 or 415 ProblemDetails response identifying the invalid field or media type

Failure boundaries

  • Reject count as a string, absent name, count below zero, additional keys, and malformed JSON before the handler runs.
  • Return 415 for text/plain; do not coerce or partially process its body.

Excluded scope

  • This fixture does not define a production business operation or persistence behavior.

Verification steps

  • pnpm --filter @aerosim/api test -- http-contract-rejection.test.ts
  • Assert the valid fixture invokes its handler once and the six invalid fixtures invoke it zero times.

Traceability

Requirements

Dependencies

UI/UX applicability

non_visual

This Task owns technical or behavioral acceptance and does not claim direct visual conformance to the approved UI/UX package.

Acceptance evidence

Verified delivery: application PR #17 reviewed head 316120fd1e1afd9a311ebaf8829580383e27df1d, exact-head validation task 1774 succeeded, merged as 746b76df3f356d68ac037bf6fda8cc7e3c9808df; integrated Gitea Actions publish task 1776 and validate task 1777 succeeded. Release completion verified on product 1.0.0.0 at GitOps revision 5d3712d89dfbf7dacd993348e55f497d126c7bf9 with Argo Synced/Healthy, exact image digests, authenticated API/database access, and three-world configured-flight acceptance.

Current evidence boundary

No current implementation, acceptance, release, or deployment evidence is claimed for this planned Task. Any prior implementation may be used only as prototype and discovery evidence.