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 /

names-pack-optional

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/c1.md
---
id: c1
type: container
links: [{"type": "mounts", "to": "v1"}]
---
nodes/ctr--link-mounts.md
---
id: ctr--link-mounts
type: link-type
fields: {"name": "mounts", "pack": "containers@1.0.0", "from": ["container", "workload"], "to": ["volume"]}
---
nodes/ctr--pack.md
---
id: ctr--pack
type: pack
fields: {"name": "containers", "namespace": "ctr", "version": "1.0.0", "pack": "containers@1.0.0", "optional": ["kubernetes@^1.0.0", "absent-pack@^1"]}
---
nodes/ctr--type-container.md
---
id: ctr--type-container
type: type
fields: {"name": "container", "pack": "containers@1.0.0"}
---
nodes/ctr--type-volume.md
---
id: ctr--type-volume
type: type
fields: {"name": "volume", "pack": "containers@1.0.0"}
---
nodes/k8s--pack.md
---
id: k8s--pack
type: pack
fields: {"name": "kubernetes", "namespace": "k8s", "version": "1.0.0", "pack": "kubernetes@1.0.0", "requires": ["containers@^1.0.0"]}
---
nodes/k8s--type-workload.md
---
id: k8s--type-workload
type: type
fields: {"name": "workload", "pack": "kubernetes@1.0.0"}
---
nodes/ot--pack.md
---
id: ot--pack
type: pack
fields: {"name": "other", "namespace": "ot", "version": "1.0.0", "pack": "other@1.0.0"}
---
nodes/ot--type-workload.md
---
id: ot--type-workload
type: type
fields: {"name": "workload", "pack": "other@1.0.0"}
---
nodes/v1.md
---
id: v1
type: ctr:volume
---
nodes/w-k8s.md
---
id: w-k8s
type: k8s:workload
links: [{"type": "mounts", "to": "v1"}]
---
nodes/w-ot.md
---
id: w-ot
type: ot:workload
links: [{"type": "mounts", "to": "v1"}]
---

Expected output

0 ghosts · 0 load errors · 12 nodes · 0 results

expected.json
{
 "ghosts": [],
 "load_errors": [],
 "nodes": [
  {
   "body": "",
   "fields": {},
   "id": "c1",
   "links": [
    {
     "to": "v1",
     "type": "mounts"
    }
   ],
   "parent": null,
   "plane": null,
   "title": "c1",
   "type": "container"
  },
  {
   "body": "",
   "fields": {
    "from": [
     "container",
     "workload"
    ],
    "name": "mounts",
    "pack": "containers@1.0.0",
    "to": [
     "volume"
    ]
   },
   "id": "ctr--link-mounts",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "ctr--link-mounts",
   "type": "link-type"
  },
  {
   "body": "",
   "fields": {
    "name": "containers",
    "namespace": "ctr",
    "optional": [
     "kubernetes@^1.0.0",
     "absent-pack@^1"
    ],
    "pack": "containers@1.0.0",
    "version": "1.0.0"
   },
   "id": "ctr--pack",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "ctr--pack",
   "type": "pack"
  },
  {
   "body": "",
   "fields": {
    "name": "container",
    "pack": "containers@1.0.0"
   },
   "id": "ctr--type-container",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "ctr--type-container",
   "type": "type"
  },
  {
   "body": "",
   "fields": {
    "name": "volume",
    "pack": "containers@1.0.0"
   },
   "id": "ctr--type-volume",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "ctr--type-volume",
   "type": "type"
  },
  {
   "body": "",
   "fields": {
    "name": "kubernetes",
    "namespace": "k8s",
    "pack": "kubernetes@1.0.0",
    "requires": [
     "containers@^1.0.0"
    ],
    "version": "1.0.0"
   },
   "id": "k8s--pack",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "k8s--pack",
   "type": "pack"
  },
  {
   "body": "",
   "fields": {
    "name": "workload",
    "pack": "kubernetes@1.0.0"
   },
   "id": "k8s--type-workload",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "k8s--type-workload",
   "type": "type"
  },
  {
   "body": "",
   "fields": {
    "name": "other",
    "namespace": "ot",
    "pack": "other@1.0.0",
    "version": "1.0.0"
   },
   "id": "ot--pack",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "ot--pack",
   "type": "pack"
  },
  {
   "body": "",
   "fields": {
    "name": "workload",
    "pack": "other@1.0.0"
   },
   "id": "ot--type-workload",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "ot--type-workload",
   "type": "type"
  },
  {
   "body": "",
   "fields": {},
   "id": "v1",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "v1",
   "type": "ctr:volume"
  },
  {
   "body": "",
   "fields": {},
   "id": "w-k8s",
   "links": [
    {
     "to": "v1",
     "type": "mounts"
    }
   ],
   "parent": null,
   "plane": null,
   "title": "w-k8s",
   "type": "k8s:workload"
  },
  {
   "body": "",
   "fields": {},
   "id": "w-ot",
   "links": [
    {
     "to": "v1",
     "type": "mounts"
    }
   ],
   "parent": null,
   "plane": null,
   "title": "w-ot",
   "type": "ot:workload"
  }
 ],
 "results": [],
 "structure": {
  "errors": [],
  "warnings": [
   {
    "kind": "link_endpoint_mismatch",
    "node": "w-ot",
    "ref": "mounts->v1"
   }
  ]
 }
}