OpenForm

Layer

Last updated on

Rendering output specification for artifacts

A Layer defines how an artifact can be rendered into a specific format. Layers enable artifacts to have multiple output representations (PDF, HTML, Markdown, etc.).

type Layer = InlineLayer | FileLayer

Layer Types

InlineLayer

Inline layer with embedded text content. Used when content is stored directly in the artifact definition.

kind: 'inline'
Discriminator for inline layer type
mimeType: string
MIME type of the content (e.g., text/markdown, text/html)
text: string
Layer content with interpolation placeholders
title?: string
Human-readable title for this layer
description?: string
Description of what this layer represents
checksum?: string
SHA-256 checksum for integrity verification
bindings?: Record<string, string>
Field bindings mapping form field names to layer target identifiers (typically for PDF)

FileLayer

File-backed layer with external file reference. Used when content is stored in a separate file.

kind: 'file'
Discriminator for file layer type
mimeType: string
MIME type of the file (e.g., application/pdf)
path: string
Absolute path from repo root to the layer file
title?: string
Human-readable title for this layer
description?: string
Description of what this layer represents
checksum?: string
SHA-256 checksum for integrity verification
bindings?: Record<string, string>
Field bindings mapping form field names to layer target identifiers (typically for PDF)

Examples

layers:
  # Inline layer with markdown content
  markdown:
    kind: inline
    mimeType: text/markdown
    title: Markdown Version
    text: |
      # Welcome

      This is the content of the document with {{ fields.name }} placeholder.

  # File layer referencing external PDF
  pdf:
    kind: file
    mimeType: application/pdf
    path: /templates/contract.pdf
    title: PDF Version
    bindings:
      client_name: clientName
      contract_date: contractDate

Related

On this page