Skip to main content

Module descriptor

Module descriptor 

Source
Expand description

Reading a resource from a YAML file.

One file describes one Resource: what it is, where it mounts, who may reach it, and the list and form screens over it.

entity: posts
path: /posts
title: Posts
permission: acme.blog.manage_posts
list:
  order_by: created_at
  order_dir: desc
  creatable: true
  columns:
    title:      { searchable: true }
    status:     { type: status_pill, width: 10% }
    created_at: { type: datetime, label: Created }
form:
  title: Post
  fields:
    title:  { rules: [required, { max_length: 120 }] }
    status: { type: select, options: [{ value: draft, label: Draft }] }

The entity, the path and the id column are written once at the top and filled into both screens, so the two cannot disagree about what they edit. A key the framework does not know is an error rather than a shrug: a typo in a data-authored admin is otherwise invisible until someone notices the screen is wrong.

Structs§

DescriptorError
What went wrong reading a descriptor file.

Functions§

from_yaml
Reads a resource from the contents of a descriptor file.