Private beta, by invitation. It may change without warning. While the beta lasts, some paid features are free. See pricing

trumlyspec GitHub
Try trumly

Conformance cases /

derived-type-name

Tests one part of the structure checks.

Our implementation passes this case when its check --json output for the input below equals the expected output.

Input

nodes/box-1.md
---
id: box-1
type: box
title: Crate
---
nodes/d-label.md
---
id: d-label
type: derived
fields:
  name: label
  applies_to:
    type: gadget
  template: '{title}-{@type}'
---
nodes/d-via.md
---
id: d-via
type: derived
fields:
  name: via
  applies_to:
    type: gadget
  template: '{runs-in/@type}-{id}'
---
nodes/g-1.md
---
id: g-1
type: gadget
title: Gizmo
links:
  - {type: runs-in, to: box-1}
---
nodes/g-2.md
---
id: g-2
type: gadget
title: Widget
---
nodes/g-3.md
---
id: g-3
type: gadget
title: Own
fields:
  '@type': custom
---

Expected output

0 ghosts · 0 load errors · 6 nodes · 0 results

expected.json
{
 "ghosts": [],
 "load_errors": [],
 "nodes": [
  {
   "body": "",
   "fields": {},
   "id": "box-1",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "Crate",
   "type": "box"
  },
  {
   "body": "",
   "fields": {
    "applies_to": {
     "type": "gadget"
    },
    "name": "label",
    "template": "{title}-{@type}"
   },
   "id": "d-label",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "d-label",
   "type": "derived"
  },
  {
   "body": "",
   "fields": {
    "applies_to": {
     "type": "gadget"
    },
    "name": "via",
    "template": "{runs-in/@type}-{id}"
   },
   "id": "d-via",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "d-via",
   "type": "derived"
  },
  {
   "body": "",
   "derived": {
    "label": {
     "values": [
      "Gizmo-gadget"
     ]
    },
    "via": {
     "values": [
      "box-g-1"
     ]
    }
   },
   "fields": {},
   "id": "g-1",
   "links": [
    {
     "to": "box-1",
     "type": "runs-in"
    }
   ],
   "parent": null,
   "plane": null,
   "title": "Gizmo",
   "type": "gadget"
  },
  {
   "body": "",
   "derived": {
    "label": {
     "values": [
      "Widget-gadget"
     ]
    },
    "via": {
     "missing": [
      "runs-in/@type"
     ]
    }
   },
   "fields": {},
   "id": "g-2",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "Widget",
   "type": "gadget"
  },
  {
   "body": "",
   "derived": {
    "label": {
     "values": [
      "Own-custom"
     ]
    },
    "via": {
     "missing": [
      "runs-in/@type"
     ]
    }
   },
   "fields": {
    "@type": "custom"
   },
   "id": "g-3",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "Own",
   "type": "gadget"
  }
 ],
 "results": [],
 "structure": {
  "errors": [],
  "warnings": []
 }
}