Documentation
    Preparing search index...
    • Creates the validators of one simulated route: param(name), query, body, and headers.

      Each validator takes the closure that performs the typia assertion. A failed assertion throws an HttpError with status 400 and a JSON body; any other error is rethrown as it is.

      Parameters

      Returns {
          body: <T>(task: () => T) => void;
          headers: <T>(task: () => T) => void;
          param: (name: string) => <T>(task: () => T) => void;
          query: <T>(task: () => T) => void;
      }

      contracts/common.md#principled-implementation The four validators share the conversion in validate and differ in the message they attach, which names the URL parameter or states that the query, body, or headers do not follow the promised type.

      contracts/common.md#clear-and-simple-design One function returning the four validators as an object, so a generated simulator has one import.

      contracts/common.md#prohibited-implementation-shortcuts The HTTP error is the one the real server returns; nothing is simulated beyond running the assertion.

      contracts/common.md#meaningful-documentation The comment states what it returns and what each validator throws.