-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* temp * temp * temp * [IDP-1845] Add documentation * PRC
- Loading branch information
Showing
19 changed files
with
630 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Publish Docs | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
pages: write # to deploy to Pages | ||
id-token: write # to verify the deployment originates from an appropriate source | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build with Retype | ||
uses: retypeapp/action-build@latest | ||
id: retype | ||
with: | ||
config: docs/retype.yaml | ||
license: ${{ secrets.RETYPE_API_KEY }} | ||
|
||
- name: Upload Retype artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: github-pages | ||
path: ${{ steps.retype.outputs.retype-output-path }} | ||
|
||
- name: Deploy to GitHub Pages | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,4 +38,7 @@ yarn-error.log* | |
.idea | ||
|
||
# project | ||
dist | ||
dist | ||
|
||
# retype | ||
retype.manifest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "docs", | ||
"private": true, | ||
"scripts": { | ||
"dev": "retype start", | ||
"build": "retype build" | ||
}, | ||
"dependencies": { | ||
"retypeapp": "3.5.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# ------------------- | ||
# Retype | ||
# ------------------- | ||
|
||
poweredByRetype: false | ||
|
||
input: ./src | ||
output: ./dist | ||
|
||
url: https://gsoft-inc.github.io/wl-openapi-typescript/ | ||
|
||
branding: | ||
title: OpenAPI TS | ||
logo: ./resources/logo.png | ||
|
||
favicon: ./resources/favicon.png | ||
|
||
edit: | ||
repo: https://github.com/gsoft-inc/wl-openapi-typescript | ||
base: ./apps/docs/src | ||
branch: main | ||
|
||
footer: | ||
copyright: "© Copyright {{ year }} - Workleap" | ||
|
||
toc: | ||
depth: 2 | ||
|
||
hub: | ||
link: https://gsoft-inc.github.io/wl-idp-docs-hub/ | ||
alt: Workleap's IDP homepage | ||
|
||
start: | ||
pro: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<link href="https://gsoft-inc.github.io/wl-idp-docs-hub/static/retype-customization.css" rel="stylesheet" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
expanded: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
icon: terminal | ||
label: CLI | ||
order: -2 | ||
--- | ||
|
||
# Command Line Interface | ||
|
||
### `create-schemas` | ||
|
||
#### Usage | ||
|
||
```bash | ||
create-schemas [input] | ||
``` | ||
|
||
#### Options | ||
|
||
Options passed to the CLI will always take precedence over options declared in | ||
the config file. | ||
|
||
| Options | Description | | ||
|-|-| | ||
| `-v, --version` | Display version number | | ||
| `-c, --config <file>` | Use specified config file (default: `"create-schemas.config"`) | | ||
| `-i, --input <path>` | Path to the OpenAPI schema file | | ||
| `-o, --outdir <path>` | Output directory (default: `"./dist"`) | | ||
| `--cwd <path>` | Path to working directory (default: `"."`) | | ||
| `--watch` | Enable watch mode | | ||
| `-h, --help` | Display available CLI options | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
icon: gear | ||
label: Configuration | ||
order: -3 | ||
--- | ||
|
||
When running `create-schemas` from the command line, it will automatically try | ||
to resolve a config file named `create-schemas.config.ts` inside project root | ||
(other JS and TS extensions are also supported). | ||
|
||
The most basic config file looks like this: | ||
|
||
```ts create-schemas.config.ts | ||
export default { | ||
// config options | ||
} | ||
``` | ||
|
||
You can use the `defineConfig` helper which should provide intellisense: | ||
|
||
```ts create-schemas.config.ts | ||
import { defineConfig } from '@workleap/create-schemas' | ||
|
||
export default defineConfig({ | ||
// example | ||
}) | ||
``` | ||
|
||
## root | ||
- **Type:** `string` | ||
- **Default:** `process.cwd()` | ||
|
||
Project root directory used to resolve relative paths. Can be an absolute path, or a path relative to the current working directory. | ||
|
||
## input | ||
- **Type:** `string` | ||
|
||
Path to the OpenAPI schema file. Can be a local path or URL to a remote file. | ||
|
||
## outdir | ||
- **Type:** `string` | ||
- **Default:** `"./dist"` | ||
|
||
Output directory path. The files that will be generated in this directory | ||
depends on the plugins being used. | ||
|
||
## watch | ||
- **Type:** `boolean` | ||
- **Default:** `false` | ||
|
||
Enable watch mode. Watch mode will regenerate the code whenever the input file | ||
or the configuration file changes. | ||
|
||
## plugins | ||
- **Type:** `Plugin[]` | ||
- **Default:** `[]` | ||
|
||
Array of plugins to use. See [Using Plugins](./using-plugins) for more details. | ||
|
||
## openApiTsOptions | ||
|
||
- **Type:** `OpenApiTsOptions` | ||
- **Default:** `{}` | ||
|
||
|
||
Options passed to OpenAPI TypeScript for type generation. You normally should | ||
not have to change them. | ||
|
||
[!ref target="blank" text="See OpenAPI TypeScript options"](https://openapi-ts.pages.dev/cli#flags) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
--- | ||
icon: rocket | ||
label: Getting Started | ||
order: -1 | ||
--- | ||
|
||
# Getting Started | ||
|
||
In your project, you can install the `create-schemas` CLI using: | ||
|
||
+++ pnpm | ||
```bash | ||
pnpm add @workleap/create-schemas | ||
``` | ||
+++ npm | ||
```bash | ||
npm install @workleap/create-schemas | ||
``` | ||
+++ yarn | ||
```bash | ||
yarn add @workleap/create-schemas | ||
``` | ||
+++ | ||
|
||
Create a `create-schemas.config.ts` file this this: | ||
|
||
```js create-schemas.config.ts | ||
import { defineConfig } from "@workleap/create-schemas"; | ||
|
||
export default defineConfig({ | ||
input: "https://petstore3.swagger.io/api/v3/openapi.json", // replace with your own OpenAPI schema | ||
output: "src/codegen/schema.ts", | ||
}); | ||
``` | ||
|
||
Then, run the `create-schemas` CLI in your terminal: | ||
|
||
+++ pnpm | ||
```bash | ||
pnpm create-schemas | ||
``` | ||
+++ npm | ||
```bash | ||
npx create-schemas | ||
``` | ||
+++ yarn | ||
```bash | ||
yarn create-schemas | ||
``` | ||
+++ | ||
|
||
The `src/codegen/schema.ts` file should be created. | ||
|
||
## Watch mode | ||
|
||
During development, you can regenerate the types whenever your input file | ||
changes or configuration changes. | ||
|
||
To enable watch mode, add the `--watch` flag to the CLI command or add `watch: | ||
true` to the configuration file. | ||
|
||
+++ pnpm | ||
```bash | ||
pnpm create-schemas --watch | ||
``` | ||
+++ npm | ||
```bash | ||
npx create-schemas --watch | ||
``` | ||
+++ yarn | ||
```bash | ||
yarn create-schemas --watch | ||
``` | ||
+++ | ||
|
||
or | ||
|
||
```js create-schemas.config.ts | ||
import { defineConfig } from "@workleap/create-schemas"; | ||
|
||
export default defineConfig({ | ||
input: "./openapi.json", | ||
watch: true, | ||
}); | ||
``` | ||
|
||
## Advanced usage | ||
|
||
If you have a more complex use case that isn't supported by | ||
`@workleap/create-schemas` you can try extending the behavior of the library by | ||
[Creating a Plugin](./using-plugins#creating-a-plugin) or using the [JavaScript API](./javascript-api). | ||
|
||
If you think many users would benefit from a use case being officially supported, we encourage you to [open an issue on Github](https://github.com/gsoft-inc/wl-openapi-typescript/issues). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
icon: book | ||
expanded: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
icon: home | ||
label: Home | ||
--- | ||
|
||
`@workleap/create-schemas` is a library for generating client code from OpenAPI Specifications. | ||
|
||
### Start here | ||
|
||
If you've never used this library before, here’s the best place to start: | ||
|
||
[!ref Getting Started](./getting-started) |
Oops, something went wrong.