gilly/gilly

Types

Builder is the main configuration record for Gilly.

It offers various options to customize the code generation process. If you’re adding codegen behaviors, try to make them configurable through the Builder.

pub opaque type Builder

Values

pub fn generate_code(
  builder: Builder,
  spec: openapi.OpenAPI,
) -> String

Generate Gleam code from an OpenAPI specification record. See’s gilly/openapi/openapi.gleam for more info on building OpenAPI records.

pub fn generate_code_from_file(
  builder: Builder,
  source: String,
) -> Result(String, @internal Error)

Generate Gleam code from an OpenAPI specification file.

Source should be a path to a JSON file containing the OpenAPI spec. Returns the generated code as a string, or an error if something goes wrong.

pub fn new() -> Builder

Create a new Gilly Builder with default configuration.

pub fn with_indent(builder: Builder, indent: Int) -> Builder

Indent configures the number of spaces used for indentation in the generated code.

pub fn with_optional_query_params(
  builder: Builder,
  optional_query_params: Bool,
) -> Builder

When setting optional_query_params to True, all query parameters in the generated client will be optional, regardless of whether they are marked as required in the OpenAPI spec or not. This is useful for non-conforming OpenAPI specs or to allow more flexibility for SDK end-users.

pub fn with_optionality(
  builder: Builder,
  optionality: @internal Optionality,
) -> Builder

Optionality determines how we decide which fields are optional in the generated code.

Search Document