Plyson
DocumentationJSON Reference

Requests

Technical reference for configuring HTTP requests in Plyson.

The request block defines the exact HTTP call to be made to your API.

Fields

  • method (Required): The HTTP verb. Supported: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS.
  • endpoint (Required): The relative API path (e.g., /users/123). This is prepended with the baseUrl from your environment. Supports :param syntax for dynamic segments.
  • queryParams (Optional): A JSON object for URL query parameters (e.g., {"limit": 10}).
  • pathParams (Optional): A JSON object for dynamic path segments. For example, endpoint: "/users/:id" with pathParams: {"id": 123} resolves to /users/123.
  • headers (Optional): A JSON object for HTTP headers (e.g., {"Authorization": "Bearer {{token}}"}).
  • payload (Optional): The request body for methods like POST or PUT.
  • autoFill (Optional): Configuration for automatic data generation based on JSON schemas.

Auto-Fill Configuration

Auto-fill allows you to generate a valid request body automatically based on a registered JSON schema.

  • schemaName (Required): The name of the schema in your schemas/ directory (e.g., User to use schemas/User.schema.json).
  • includeFields (Optional): Explicitly list only the fields you want to generate.
  • excludeFields (Optional): List fields from the schema that should be omitted.
"autoFill": {
  "schemaName": "User",
  "excludeFields": ["id", "createdAt"]
}

Payload Construction Logic

When both autoFill and a manual payload are provided in the same request, Plyson uses a merge-and-override strategy:

  1. Base Generation: Plyson first generates a complete JSON body based on the schema specified in autoFill.
  2. Explicit Override: Any fields defined in the manual payload object are applied on top of the generated data.
  3. Result: If a field exists in both, the value in the manual payload always wins.

Behind the Scenes: How it Merges

Imagine your User schema has three fields: name, email, and role.

1. Generated by autoFill

{ "name": "John Doe", "email": "john@example.com", "role": "USER" }

2. Your manual payload override

{ "email": "invalid-format" }

3. Final Payload (Sent to API)

{ "name": "John Doe", "email": "invalid-format", "role": "USER" }

This allows you to generate a valid data set automatically, but surgically "break" or customize specific fields for testing.

{
  "method": "PUT",
  "endpoint": "/users/:id",
  "pathParams": {
    "id": "{{userId}}"
  },
  "headers": {
    "Content-Type": "application/json"
  },
  "autoFill": {
    "schemaName": "User"
  },
  "payload": {
    "email": { "$gen": "email" }
  }
}

On this page