{
  "@type": "HeadlessPages",
  "@id": "/_api/headless_pages/2014",
  "uid": 2014,
  "title": "Contract",
  "slug": "/contract",
  "seo_title": "",
  "description": "The OpenAPI document of the site and the TypeScript types generated from it.",
  "no_index": 0,
  "no_follow": 0,
  "canonical_link": null,
  "og_title": "",
  "og_description": null,
  "og_image": [],
  "breadcrumbs": [
    {
      "uid": 2000,
      "title": "tca-api-headless",
      "nav_title": "",
      "url": "https://typo3.example/website/",
      "doktype": 1
    },
    {
      "uid": 2014,
      "title": "Contract",
      "nav_title": "",
      "url": "https://typo3.example/website/contract",
      "doktype": 1
    }
  ],
  "languages": [
    {
      "languageId": 0,
      "locale": "en-US",
      "hreflang": "en",
      "title": "English",
      "url": "https://typo3.example/website/contract",
      "available": true,
      "active": true
    },
    {
      "languageId": 1,
      "locale": "de-DE",
      "hreflang": "de",
      "title": "German",
      "url": "https://typo3.example/website/de/vertrag",
      "available": true,
      "active": false
    }
  ],
  "meta": {
    "robots": "index,follow",
    "canonical": "https://typo3.example/website/contract",
    "schema": {
      "@context": "https://schema.org",
      "@type": "WebPage",
      "url": "https://typo3.example/website/contract",
      "name": "Contract",
      "inLanguage": "en",
      "description": "The OpenAPI document of the site and the TypeScript types generated from it."
    },
    "alternates": [
      {
        "hreflang": "en",
        "href": "https://typo3.example/website/contract"
      },
      {
        "hreflang": "de",
        "href": "https://typo3.example/website/de/vertrag"
      },
      {
        "hreflang": "x-default",
        "href": "https://typo3.example/website/contract"
      }
    ]
  },
  "regions": {
    "main": [
      {
        "uid": 2210,
        "CType": "text",
        "header": "The contract",
        "header_layout": 0,
        "header_position": "",
        "header_link": null,
        "subheader": "",
        "bodytext": [
          {
            "_type": "block",
            "_key": "k0",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k1",
                "marks": [],
                "text": "TCA API writes an OpenAPI document per site, and tca-api-headless types everything it adds: regions, every content type, links, the navigation tree and the lookup. This is this site's document, read while the page was built:"
              }
            ]
          },
          {
            "_type": "block",
            "_key": "k2",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k3",
                "marks": [
                  "code"
                ],
                "text": "GET /_api/openapi.json"
              }
            ]
          }
        ],
        "layout": 0,
        "frame_class": "default",
        "space_before_class": "",
        "space_after_class": ""
      },
      {
        "uid": 2211,
        "CType": "text",
        "header": "Generated, then compared",
        "header_layout": 0,
        "header_position": "",
        "header_link": null,
        "subheader": "",
        "bodytext": [
          {
            "_type": "block",
            "_key": "k0",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k1",
                "marks": [],
                "text": "This site generates its TypeScript declarations from that document with openapi-typescript, and its CI fails when they drift apart. Every proof on this site shows the type of its element, cut from those declarations."
              }
            ]
          },
          {
            "_type": "block",
            "_key": "k2",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k3",
                "marks": [
                  "code"
                ],
                "text": "bunx openapi-typescript openapi.json -o src/api/schema.d.ts"
              }
            ]
          },
          {
            "_type": "block",
            "_key": "k4",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k5",
                "marks": [],
                "text": "The CLI writes the same document without a web request:"
              }
            ]
          },
          {
            "_type": "block",
            "_key": "k6",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k7",
                "marks": [
                  "code"
                ],
                "text": "vendor/bin/typo3 tca-api:openapi website --output openapi.json"
              }
            ]
          }
        ],
        "layout": 0,
        "frame_class": "default",
        "space_before_class": "",
        "space_after_class": ""
      },
      {
        "uid": 2212,
        "CType": "text",
        "header": "One document per site",
        "header_layout": 0,
        "header_position": "",
        "header_link": null,
        "subheader": "",
        "bodytext": [
          {
            "_type": "block",
            "_key": "k0",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k1",
                "marks": [],
                "text": "The document belongs to its site. Kettenblatt allows the fallback type "
              },
              {
                "_type": "span",
                "_key": "k2",
                "marks": [
                  "code"
                ],
                "text": "menu_subpages"
              },
              {
                "_type": "span",
                "_key": "k3",
                "marks": [],
                "text": ", so only its document has "
              },
              {
                "_type": "span",
                "_key": "k4",
                "marks": [
                  "code"
                ],
                "text": "HeadlessContentFallbackRead"
              },
              {
                "_type": "span",
                "_key": "k5",
                "marks": [],
                "text": ", and its frontend needs types of its own:"
              }
            ]
          },
          {
            "_type": "block",
            "_key": "k6",
            "style": "normal",
            "markDefs": [],
            "children": [
              {
                "_type": "span",
                "_key": "k7",
                "marks": [
                  "code"
                ],
                "text": "GET https://kettenblatt.example/_api/openapi.json"
              }
            ]
          }
        ],
        "layout": 0,
        "frame_class": "default",
        "space_before_class": "",
        "space_after_class": ""
      }
    ]
  }
}