Skip to main content

Generate RTK Query TypeScript from OpenAPI (cached JSON).

Project description

exdrf-gen-openapi2rtk

exdrf-gen-openapi2rtk is an exdrf-gen plugin that turns an OpenAPI 3.x JSON document into RTK Query TypeScript modules (endpoints, hooks, and generated request/response wiring). It can load a local file or fetch a remote spec with optional HTTP caching.

Python 3.12.2+ is required. Dependencies (attrs, click, exdrf-gen, exdrf-ts) are listed in pyproject.toml.

Plugin registration

[project.entry-points.'exdrf.plugins']
exdrf_gen = 'exdrf_gen_openapi2rtk'

Install exdrf-gen and exdrf-gen-openapi2rtk in the same environment; then exdrf-gen --help lists openapi2rtk.

Usage

CLI

The command is registered on the shared exdrf-gen CLI as openapi2rtk:

python -m exdrf_gen openapi2rtk /path/to/routes/out \
  --openapi-file /path/to/openapi.json \
  --types-import "@app/models" \
  --base-api-profile minimal

Use --base-api-profile fr_one when generating for the fr-one customer SPA (same wiring as historical resi_gen r2ts output).

Remote specs: pass --openapi-url (and optional cache flags) instead of or in addition to --openapi-file—see exdrf-gen --help / subcommand help for the exact options in your installed version.

See also

  • resi_gen r2ts in bk-one snapshots app.openapi(), then calls this generator with --types-import @resi/models and fr_one base API.
  • exdrf-gen — shared CLI, Jinja environment, and plugin loading.
  • exdrf-ts — type mapping helpers used during emission.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

exdrf_gen_openapi2rtk-0.1.18.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

exdrf_gen_openapi2rtk-0.1.18-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file exdrf_gen_openapi2rtk-0.1.18.tar.gz.

File metadata

  • Download URL: exdrf_gen_openapi2rtk-0.1.18.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for exdrf_gen_openapi2rtk-0.1.18.tar.gz
Algorithm Hash digest
SHA256 97a916a7b99e1c95f06e531a1cf7b2c14547a7d9ebd73a8e23986134c1aa3381
MD5 5679078cc0d833bccef5c6667adbc0bf
BLAKE2b-256 096c5d9003cefaec2a1571690134f0812ee3b7f0aef6bf288a30bc97dd241a99

See more details on using hashes here.

File details

Details for the file exdrf_gen_openapi2rtk-0.1.18-py3-none-any.whl.

File metadata

File hashes

Hashes for exdrf_gen_openapi2rtk-0.1.18-py3-none-any.whl
Algorithm Hash digest
SHA256 08ffed72f530604e37dcc93d5bdfb26c7f5d5d419ffe105580430611df99e0e9
MD5 282424acbb21f532ba5723793e7b30cb
BLAKE2b-256 510a20289cdeb9c362418a4074fd9c8e01ef37abc651b9983b50d2e948d85bb1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page