nori/config

Config file support for the OpenAPI code generator.

Loads a YAML config file that specifies which targets to generate, output directories, and target-specific options.

Types

Top-level configuration.

pub type Config {
  Config(spec: String, output: OutputConfig)
}

Constructors

Errors that can occur when loading a config file.

pub type ConfigError {
  ConfigFileNotFound(path: String)
  ConfigParseError(message: String)
}

Constructors

  • ConfigFileNotFound(path: String)
  • ConfigParseError(message: String)

Output configuration for all targets.

pub type OutputConfig {
  OutputConfig(
    gleam: TargetConfig,
    typescript: TargetConfig,
    react_query: TargetConfig,
    swr: TargetConfig,
    fetch: TargetConfig,
  )
}

Constructors

Configuration for a single code generation target.

pub type TargetConfig {
  TargetConfig(
    enabled: Bool,
    dir: String,
    generated_suffix: Bool,
    options: dict.Dict(String, String),
  )
}

Constructors

  • TargetConfig(
      enabled: Bool,
      dir: String,
      generated_suffix: Bool,
      options: dict.Dict(String, String),
    )

Values

pub fn default() -> Config

Returns the default configuration with all targets enabled.

pub fn default_target(dir: String, suffix: Bool) -> TargetConfig

Creates a default target config with the given dir and suffix setting.

pub fn load(path: String) -> Result(Config, ConfigError)

Loads a config from a YAML file.

Search Document