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.17.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.17-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: exdrf_gen_openapi2rtk-0.1.17.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.17.tar.gz
Algorithm Hash digest
SHA256 806f7d45e97c71e3a009150b6dde976b4e4bda4c55efbcc9571c96b793ba80b1
MD5 55ad189b0b51e4d367840e039c64ca61
BLAKE2b-256 1e15430e0171409a14f981f382e19af1a077f858d5757fb962248b0491addbee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for exdrf_gen_openapi2rtk-0.1.17-py3-none-any.whl
Algorithm Hash digest
SHA256 444c2c674c04683b9166f55352195adf1fd21ce3ca0ba25897122bc21acd3771
MD5 78b5a45858a39c175617361d9fca2160
BLAKE2b-256 443d3cb580897806988753df1cf721a0bdd71a2542acea8cdee469796a22459b

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