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 /

required-fields

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/other-thing.md
---
id: other-thing
type: gadget
---
nodes/p-draft.md
---
id: p-draft
type: plane
fields: { order: 1, scratch: true }
---
nodes/service-draft.md
---
id: service-draft
type: service
plane: p-draft
---
nodes/service-empty.md
---
id: service-empty
type: service
fields: { owner: "", tier: gold }
---
nodes/service-null.md
---
id: service-null
type: service
fields: { owner: null }
---
nodes/service-ok.md
---
id: service-ok
type: service
fields: { owner: ana, tier: gold }
---
nodes/service-zero.md
---
id: service-zero
type: service
fields: { owner: 0, tier: false }
---
nodes/type-service.md
---
id: type-service
type: type
fields:
  name: service
  fields:
    - { name: owner, kind: text, required: true }
    - { name: tier, kind: choice, values: [gold, silver], required: true }
    - { name: note, kind: text }
    - { name: flag, kind: boolean, required: "yes" }
---

Expected output

0 ghosts · 0 load errors · 8 nodes · 0 results

expected.json
{
 "ghosts": [],
 "load_errors": [],
 "nodes": [
  {
   "body": "",
   "fields": {},
   "id": "other-thing",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "other-thing",
   "type": "gadget"
  },
  {
   "body": "",
   "fields": {
    "order": 1,
    "scratch": true
   },
   "id": "p-draft",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "p-draft",
   "type": "plane"
  },
  {
   "body": "",
   "fields": {},
   "id": "service-draft",
   "links": [],
   "parent": null,
   "plane": "p-draft",
   "title": "service-draft",
   "type": "service"
  },
  {
   "body": "",
   "fields": {
    "owner": "",
    "tier": "gold"
   },
   "id": "service-empty",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "service-empty",
   "type": "service"
  },
  {
   "body": "",
   "fields": {
    "owner": null
   },
   "id": "service-null",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "service-null",
   "type": "service"
  },
  {
   "body": "",
   "fields": {
    "owner": "ana",
    "tier": "gold"
   },
   "id": "service-ok",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "service-ok",
   "type": "service"
  },
  {
   "body": "",
   "fields": {
    "owner": 0,
    "tier": false
   },
   "id": "service-zero",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "service-zero",
   "type": "service"
  },
  {
   "body": "",
   "fields": {
    "fields": [
     {
      "kind": "text",
      "name": "owner",
      "required": true
     },
     {
      "kind": "choice",
      "name": "tier",
      "required": true,
      "values": [
       "gold",
       "silver"
      ]
     },
     {
      "kind": "text",
      "name": "note"
     },
     {
      "kind": "boolean",
      "name": "flag",
      "required": "yes"
     }
    ],
    "name": "service"
   },
   "id": "type-service",
   "links": [],
   "parent": null,
   "plane": null,
   "title": "type-service",
   "type": "type"
  }
 ],
 "results": [],
 "structure": {
  "errors": [],
  "warnings": [
   {
    "kind": "missing_required_field",
    "node": "service-empty",
    "ref": "owner"
   },
   {
    "kind": "missing_required_field",
    "node": "service-null",
    "ref": "owner"
   },
   {
    "kind": "missing_required_field",
    "node": "service-null",
    "ref": "tier"
   }
  ]
 }
}