playwright-test-commons - v0.8.0
    Preparing search index...

    Function createJsonSchema

    • Writes a strict JSON Schema (draft-07) inferred from a response body. Every object gets additionalProperties: false, and fields that were null become ["null", "string"]. Review the file and tighten it by hand (required fields, enums, formats) before committing.

      Usually called through validateJsonSchema(name, body, { update: true }) or UPDATE_SCHEMAS=true, not directly.

      Parameters

      • schemasDir: string

        the schemas folder

      • name: string

        schema name, e.g. "posts/getPost"

      • body: unknown

        a real response body to infer the schema from

      Returns Promise<void>

      Error if the name resolves outside schemasDir