Skip to content

schemas.openapi.codegen #

fn media_type_to_param #

fn media_type_to_param(mt openapi.MediaType) code.Param

converts OpenAPI Parameter Specification to code param specification

fn parameter_to_param #

fn parameter_to_param(parameter openapi.Parameter) code.Param

converts OpenAPI Parameter Specification to code param specification

fn responses_to_param #

fn responses_to_param(responses map[string]ResponseSpec) code.Param

converts OpenAPI map[string]ResponseSpec Specification to code param specification

fn ts_client_folder #

fn ts_client_folder(spec OpenAPI, params GenerationParams) !Folder

fn ts_client_methods_file #

fn ts_client_methods_file(spec OpenAPI, params GenerationParams) File

generates a methods.ts file for given actor methods

fn ts_client_model_file #

fn ts_client_model_file(schemas []Schema) File

generates a model.ts file for given base objects

type BodyGenerator #

type BodyGenerator = fn (op Operation, path string, method http.Method) string

the body_generator is a function that takes an OpenAPI operation, its path, and its method and returns a client function's body. This is used for custom client generation.

struct GenerationParams #

@[params]
struct GenerationParams {
pub:
	// by default the TS Client Genrator generates empty bodies
	// for client methods
	custom_client_code string // custom code to be injected into client class
	body_generator     BodyGenerator = generate_empty_body
}

struct TSClientFunctionParams #

@[params]
struct TSClientFunctionParams {
	endpoint string // prefix for the Rest API endpoint
}