OpenAPI-Qraft / openapi-qraft

Generate a type-safe OpenAPI client for your React app
https://openapi-qraft.github.io/openapi-qraft/
MIT License
19 stars 1 forks source link

feat: OpenAPI TypeScript plugin #67

Closed radist2s closed 2 months ago

radist2s commented 2 months ago

Summary

Introducing the new --plugin <name> option to the OpenAPI Qraft CLI, enhancing its flexibility and integration capabilities with different development environments. This update allows users to specify which plugins to utilize during the generation of API services and TypeScript types, directly from the OpenAPI Document.

New Features

Usage

The --plugin option can be used as follows in the CLI:

npx openapi-qraft --plugin tanstack-query-react --plugin openapi-typescript https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml \
  --output-dir src/api

Benefits

Example Configuration

In the project's package.json, you might add:

"scripts": {
  "generate-client": "openapi-qraft --plugin tanstack-query-react --plugin openapi-typescript https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml --output-dir src/api"
}
changeset-bot[bot] commented 2 months ago

🦋 Changeset detected

Latest commit: a4b89deafb12b77bc7be84966850bd40f282ae22

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages | Name | Type | | ------------------------------------------ | ----- | | @openapi-qraft/plugin | Minor | | @openapi-qraft/cli | Minor | | @openapi-qraft/openapi-typescript-plugin | Patch | | @openapi-qraft/tanstack-query-react-plugin | Minor | | @openapi-qraft/react | Minor |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

github-actions[bot] commented 2 months ago

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

Unrecognized words (1)

APITS

Previously acknowledged words that are now absent dev 🫥
To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands ... in a clone of the [git@github.com:OpenAPI-Qraft/openapi-qraft.git](https://github.com/OpenAPI-Qraft/openapi-qraft.git) repository on the `feature/openapi-typescript-plugin` branch ([:information_source: how do I use this?]( https://github.com/check-spelling/check-spelling/wiki/Accepting-Suggestions)): ``` sh curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.22/apply.pl' | perl - 'https://github.com/OpenAPI-Qraft/openapi-qraft/actions/runs/8955570915/attempts/1' ```

OR

To have the bot accept them for you, reply quoting the following line: @check-spelling-bot apply updates.

Available :books: dictionaries could cover words (expected and unrecognized) not in the :blue_book: dictionary This includes both **expected items** (84) from .github/actions/spelling/expect.txt and **unrecognized words** (1) Dictionary | Entries | Covers | Uniquely -|-|-|- [cspell:aws/aws.txt](https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/aws/aws.txt)|218|6|3| [cspell:k8s/dict/k8s.txt](https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/k8s/dict/k8s.txt)|153|4|2| [cspell:dotnet/dict/dotnet.txt](https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/dotnet/dict/dotnet.txt)|405|4|2| [cspell:python/src/python/python-lib.txt](https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/python/src/python/python-lib.txt)|2417|3|2| [cspell:php/dict/php.txt](https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/php/dict/php.txt)|1689|2|1| Consider adding them (in `.github/workflows/spelling.yml`) for `uses: check-spelling/check-spelling@v0.0.22` in its `with`: ``` yml with: extra_dictionaries: cspell:aws/aws.txt cspell:k8s/dict/k8s.txt cspell:dotnet/dict/dotnet.txt cspell:python/src/python/python-lib.txt cspell:php/dict/php.txt ``` To stop checking additional dictionaries, add (in `.github/workflows/spelling.yml`) for `uses: check-spelling/check-spelling@v0.0.22` in its `with`: ``` yml check_extra_dictionaries: '' ```
github-actions[bot] commented 2 months ago

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

Unrecognized words (1)

webhooks

Previously acknowledged words that are now absent dev Open Options 🫥
To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands ... in a clone of the [git@github.com:OpenAPI-Qraft/openapi-qraft.git](https://github.com/OpenAPI-Qraft/openapi-qraft.git) repository on the `feature/openapi-typescript-plugin` branch ([:information_source: how do I use this?]( https://github.com/check-spelling/check-spelling/wiki/Accepting-Suggestions)): ``` sh curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.22/apply.pl' | perl - 'https://github.com/OpenAPI-Qraft/openapi-qraft/actions/runs/9038496007/attempts/1' ```

OR

To have the bot accept them for you, reply quoting the following line: @check-spelling-bot apply updates.

Available :books: dictionaries could cover words (expected and unrecognized) not in the :blue_book: dictionary This includes both **expected items** (84) from .github/actions/spelling/expect.txt and **unrecognized words** (1) Dictionary | Entries | Covers | Uniquely -|-|-|- [cspell:aws/aws.txt](https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/aws/aws.txt)|218|7|3| [cspell:k8s/dict/k8s.txt](https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/k8s/dict/k8s.txt)|153|5|2| [cspell:dotnet/dict/dotnet.txt](https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/dotnet/dict/dotnet.txt)|405|4|2| [cspell:python/src/python/python-lib.txt](https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/python/src/python/python-lib.txt)|2417|3|2| [cspell:php/dict/php.txt](https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/php/dict/php.txt)|1689|2|1| Consider adding them (in `.github/workflows/spelling.yml`) for `uses: check-spelling/check-spelling@v0.0.22` in its `with`: ``` yml with: extra_dictionaries: cspell:aws/aws.txt cspell:k8s/dict/k8s.txt cspell:dotnet/dict/dotnet.txt cspell:python/src/python/python-lib.txt cspell:php/dict/php.txt ``` To stop checking additional dictionaries, add (in `.github/workflows/spelling.yml`) for `uses: check-spelling/check-spelling@v0.0.22` in its `with`: ``` yml check_extra_dictionaries: '' ```