Skip to content
Francisco Dias edited this page Aug 19, 2026 · 6 revisions

GM-OpenAPIGenerator

GM-OpenAPIGenerator reads an OpenAPI 3.x specification (JSON or YAML) and generates a complete GameMaker Language (GML) HTTP client layer — typed schema structs, endpoint wrapper functions, an authentication helper, a cookie jar, and a controller object you paste into a manager object.

What it does

  • Schema structs — each #/components/schemas object becomes a GML constructor with per-field runtime type validation.
  • Endpoint wrappers — one GML function per API operation: builds the URL, handles path/query/header/cookie parameters, serialises the request body to the right content-type, attaches auth tokens, and fires the HTTP request.
  • Auth layer — reads components.securitySchemes, generates token storage/retrieval helpers, and injects credentials (Basic, Bearer, API key, OAuth 2) per request automatically.
  • Cookie jar — transparently captures Set-Cookie response headers and injects them into every subsequent request. A public API lets game code read, write, and clear cookies manually.
  • Body converters — built-in serialisers for application/json, application/x-www-form-urlencoded, multipart/form-data, and text/plain. Custom converters can be registered at runtime.
  • Response hooks — register per-HTTP-status-code intercept functions that run before the callback.
  • Documentation stubs — optional docs.schemas / docs.functions outputs generate gm-ext-compatible JS doc files for the online/offline wiki pipeline.

Quick start

openapigen.exe --init ./myapi
# edit myapi/config.json — set "input" to your spec path
openapigen.exe --config ./myapi/config.json

Copy the output files into your GameMaker project and paste the three controller snippets into obj_gm_core's Create, Async HTTP, and Cleanup events.

Wiki

Requirements

  • .NET 9 SDK (build and run)
  • An OpenAPI 3.x document (JSON or YAML)
  • GameMaker 2024+ for the generated GML

Clone this wiki locally