nori/cli
CLI module for the OpenAPI library.
Provides generate, bundle, and validate commands.
Run with: gleam run -m nori/cli
Values
pub fn derive_module_prefix(dir: String) -> String
Derive a Gleam module prefix from the configured output directory.
Looks for a src segment anywhere in the path and takes everything after
it (Gleam module paths are rooted at src/).
Examples: “./src/generated” -> “generated” “src/generated” -> “generated” “/tmp/proj/src/api/gen” -> “api/gen” “./generated” -> “generated” (relative, assumed src-rooted) “src” or “./src” -> “” (top-level — no prefix) “/tmp/out” -> “” (absolute, no src/ — unknowable)
Returning “” disables real-import emission and falls back to a comment hint.
That is always the safe answer: an unusable prefix produces a generated
import that does not parse, which is worse than no import at all.
pub fn plan_files(
codegen_ir: ir.CodegenIR,
cfg: config.Config,
output_override: String,
) -> List(plugin.GeneratedFile)
The files a config would write, without writing them.
Which targets run and where each file lands are the two config decisions that
have surprised people, so this is public: tests assert on the real planner
rather than re-deriving its rules, and a future --dry-run needs exactly
this.
pub fn unknown_dirs_keys(tc: config.TargetConfig) -> List(String)
Names in dirs that are not generated files.
A typo like route: would otherwise be accepted in silence and the file
would go to dir, which looks exactly like the override being ignored —
because it is.