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 /

ghost-multiple

Tests ghosts: nodes that are linked to but not defined.

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

Input

nodes/a.md
---
id: a
type: svc
plane: p
links:
  - type: uses
    to: x
---
nodes/p.md
---
id: p
type: plane
fields:
  order: 1
---
nodes/q.md
---
id: q
type: plane
fields:
  order: 2
---
nodes/r.md
---
id: r
type: rule
fields:
  statement: s
  applies_to: {type: svc}
  check: {require_link: [{type: owns, node_type: team, node_plane: q}, {type: uses, min: 2}, {type: ok}]}
---
nodes/x.md
---
id: x
type: dep
plane: q
---

Expected output

3 ghosts · 0 load errors · 5 nodes · 1 results

expected.json
{
 "ghosts": [
  {
   "link": "owns",
   "node": "a",
   "plane": "q",
   "rule": "r",
   "to_type": "team"
  },
  {
   "link": "uses",
   "node": "a",
   "plane": "p",
   "rule": "r",
   "to_type": null
  },
  {
   "link": "ok",
   "node": "a",
   "plane": "p",
   "rule": "r",
   "to_type": null
  }
 ],
 "load_errors": [],
 "nodes": [
  {
   "body": "",
   "fields": {},
   "id": "a",
   "links": [
    {
     "to": "x",
     "type": "uses"
    }
   ],
   "parent": null,
   "plane": "p",
   "title": "a",
   "type": "svc"
  },
  {
   "body": "",
   "fields": {
    "order": 1
   },
   "id": "p",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "p",
   "type": "plane"
  },
  {
   "body": "",
   "fields": {
    "order": 2
   },
   "id": "q",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "q",
   "type": "plane"
  },
  {
   "body": "",
   "fields": {
    "applies_to": {
     "type": "svc"
    },
    "check": {
     "require_link": [
      {
       "node_plane": "q",
       "node_type": "team",
       "type": "owns"
      },
      {
       "min": 2,
       "type": "uses"
      },
      {
       "type": "ok"
      }
     ]
    },
    "statement": "s"
   },
   "id": "r",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "r",
   "type": "rule"
  },
  {
   "body": "",
   "fields": {},
   "id": "x",
   "links": [],
   "parent": null,
   "plane": "q",
   "title": "x",
   "type": "dep"
  }
 ],
 "results": [
  {
   "node": "a",
   "rule": "r",
   "severity": "warn",
   "status": "fail"
  }
 ],
 "structure": {
  "errors": [],
  "warnings": []
 }
}