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-ambiguous

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/aws--link-runs-on.md
---
id: aws--link-runs-on
type: link-type
fields: {"name": "runs-on", "pack": "aws@1.0.0"}
---
nodes/aws--pack.md
---
id: aws--pack
type: pack
fields: {"name": "aws", "version": "1.0.0", "pack": "aws@1.0.0"}
---
nodes/aws--type-service.md
---
id: aws--type-service
type: type
fields: {"name": "service", "pack": "aws@1.0.0"}
---
nodes/aws-one.md
---
id: aws-one
type: aws:service
links: [{"type": "aws:runs-on", "to": "bare"}]
---
nodes/bare.md
---
id: bare
type: service
links: [{"type": "runs-on", "to": "aws-one"}]
---
nodes/k8s--link-runs-on.md
---
id: k8s--link-runs-on
type: link-type
fields: {"name": "runs-on", "pack": "k8s@1.0.0"}
---
nodes/k8s--pack.md
---
id: k8s--pack
type: pack
fields: {"name": "k8s", "version": "1.0.0", "pack": "k8s@1.0.0"}
---
nodes/k8s--rule-ns.md
---
id: k8s--rule-ns
type: rule
fields: {"applies_to": {"type": "service"}, "check": {"require_fields": ["namespace"]}, "severity": "warn", "pack": "k8s@1.0.0"}
---
nodes/k8s--type-service.md
---
id: k8s--type-service
type: type
fields: {"name": "service", "pack": "k8s@1.0.0"}
---

Expected output

0 ghosts · 0 load errors · 9 nodes · 1 results

expected.json
{
 "ghosts": [],
 "load_errors": [],
 "nodes": [
  {
   "body": "",
   "fields": {
    "name": "runs-on",
    "pack": "aws@1.0.0"
   },
   "id": "aws--link-runs-on",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "aws--link-runs-on",
   "type": "link-type"
  },
  {
   "body": "",
   "fields": {
    "name": "aws",
    "pack": "aws@1.0.0",
    "version": "1.0.0"
   },
   "id": "aws--pack",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "aws--pack",
   "type": "pack"
  },
  {
   "body": "",
   "fields": {
    "name": "service",
    "pack": "aws@1.0.0"
   },
   "id": "aws--type-service",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "aws--type-service",
   "type": "type"
  },
  {
   "body": "",
   "fields": {},
   "id": "aws-one",
   "links": [
    {
     "to": "bare",
     "type": "aws:runs-on"
    }
   ],
   "parent": null,
   "plane": null,
   "title": "aws-one",
   "type": "aws:service"
  },
  {
   "body": "",
   "fields": {},
   "id": "bare",
   "links": [
    {
     "to": "aws-one",
     "type": "runs-on"
    }
   ],
   "parent": null,
   "plane": null,
   "title": "bare",
   "type": "service"
  },
  {
   "body": "",
   "fields": {
    "name": "runs-on",
    "pack": "k8s@1.0.0"
   },
   "id": "k8s--link-runs-on",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "k8s--link-runs-on",
   "type": "link-type"
  },
  {
   "body": "",
   "fields": {
    "name": "k8s",
    "pack": "k8s@1.0.0",
    "version": "1.0.0"
   },
   "id": "k8s--pack",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "k8s--pack",
   "type": "pack"
  },
  {
   "body": "",
   "fields": {
    "applies_to": {
     "type": "service"
    },
    "check": {
     "require_fields": [
      "namespace"
     ]
    },
    "pack": "k8s@1.0.0",
    "severity": "warn"
   },
   "id": "k8s--rule-ns",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "k8s--rule-ns",
   "type": "rule"
  },
  {
   "body": "",
   "fields": {
    "name": "service",
    "pack": "k8s@1.0.0"
   },
   "id": "k8s--type-service",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "k8s--type-service",
   "type": "type"
  }
 ],
 "results": [
  {
   "node": "bare",
   "rule": "k8s--rule-ns",
   "severity": "warn",
   "status": "fail"
  }
 ],
 "structure": {
  "errors": [],
  "warnings": [
   {
    "kind": "ambiguous_link_type",
    "node": "bare",
    "ref": "runs-on"
   },
   {
    "kind": "ambiguous_type",
    "node": "bare",
    "ref": "service"
   }
  ]
 }
}