{
  "id": 18093343,
  "title": "Insomnia's Nunjucks Template Tags vs Declarative Spec Values",
  "url": "https://urgent.news/2026/11/04/insomnias-nunjucks-template-tags-vs-declarative-spec-values",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-04T08:38:51.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/jeff_pdc/insomnias-nunjucks-template-tags-vs-declarative-spec-values-13ao"
  },
  "original_language": "en",
  "account": "Insomnia's Nunjucks template tags inject dynamic values such as timestamps, random IDs, and variables into requests. These tags are powerful for one-off client behavior but are tied to the client and harder to validate. In contrast, declarative spec values are described in an OpenAPI schema, making them readable by any OpenAPI tool and portable.\n\nNunjucks expressions, living inside double braces, are evaluated when the request is sent. While tags solve the problem of needing unique identifiers or current timestamps in every request, they encode dynamic behavior into a string format unique to Insomnia.\n\nDeclarative spec values, on the other hand, live in the schema, describing defaults, constraints, and types. This separation of concerns enables portable behavior - the contract declares the field's shape, while code generates the actual value.\n\nFor example, an order ID can be a string with a specific format. The contract declares this shape, while a client or test harness provides the actual UUID. This way, generators and test code handle dynamic generation, keeping the contract as the source of truth.\n\nHowever, it's risky to embed logic in strings as tools can't inspect it. A linter can't check UUID formats, and diffs show string changes rather than logic changes.\n\nTemplates shine for quick exploratory work or client-specific conveniences not suited for the contract. But when template tags encode real business logic, moving that logic into code or the contract makes the requests testable and reviewable in CI.\n\nTo migrate, ask what each template tag is producing. A UUID maps to a schema format and generator, an environment reference maps to runtime configuration, and chained response values map to generated client flows passing data between calls. Replacing tags with a schema and generator removes client lock-in, making requests runnable in CI without a GUI.",
  "summary": "Quick answer: Insomnia uses Nunjucks template tags to inject dynamic values like timestamps, random IDs, or variables into request fields. They are powerful for ad hoc dynamic requests, but the logic is embedded in a client-specific string syntax that does not travel with an OpenAPI contract. A declarative spec describes values, defaults, and constraints as data, which any tool can read. Use…",
  "key_points": [
    "Nunjucks template tags inject dynamic values like timestamps and IDs into Insomnia requests.",
    "Migrating tags to schema and generators removes client lock-in and enables CI testing."
  ],
  "editors_take": "Moving logic from client-side template tags into declarative OpenAPI schemas shifts the source of truth from proprietary strings to portable contracts that enable automated testing and CI integration.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}