Skip to content

okforest/type-file-name

warningOKForest conventions

A type’s schema and template in .okforest/types/ are named for it: Customer Profile in customer-profile.schema.json and customer-profile.template.md.

A type’s schema and template in .okforest/types/ are found by its name: okforest types init writes customer-profile.schema.json for Customer Profile, and people look for a type’s files the same way. OKForest reads which type a file is for from inside it (a schema’s title, a template’s type), so a file named for another type still works, but it misleads anyone reading the folder, and it’s what renaming a type or splitting a tree leaves behind. The name is the type in lowercase, with a hyphen for each run of spaces and punctuation (Types).

This file breaks the rule:

.okforest/types/kpi.schema.json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Metric",
"description": "A number the business tracks.",
"type": "object"
}

okforest validate reports:

.okforest/types/kpi.schema.json
3:3 warning This schema is for `Metric`, so name it `metric.schema.json`, or make its `title` the type its name says. okforest/type-file-name

Fixed, renamed to .okforest/types/metric.schema.json:

.okforest/types/metric.schema.json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Metric",
"description": "A number the business tracks.",
"type": "object"
}