Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: actions/setup-node@v4
if: ${{ steps.release.outputs.releases_created }}
with:
node-version: 20
node-version: 22
registry-url: "https://registry.npmjs.org"
- name: Build Packages
if: ${{ steps.release.outputs.releases_created }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js 20
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
cache: "pnpm"
- name: Install dependencies
run: pnpm install
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ web_modules/
# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache
# Optional oxlint cache
.oxlintcache

# Microbundle cache
.rpt2_cache/
Expand Down
132 changes: 132 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["typescript"],
"categories": {
"correctness": "off"
},
"env": {
"builtin": true,
"browser": true,
"node": true
},
"ignorePatterns": ["**/lib/*", "examples/frontend/src/github/*"],
"rules": {
"constructor-super": "error",
"for-direction": "error",
"getter-return": "error",
"no-async-promise-executor": "error",
"no-case-declarations": "error",
"no-class-assign": "error",
"no-compare-neg-zero": "error",
"no-cond-assign": "error",
"no-const-assign": "error",
"no-constant-binary-expression": "error",
"no-constant-condition": "error",
"no-control-regex": "error",
"no-debugger": "error",
"no-delete-var": "error",
"no-dupe-class-members": "error",
"no-dupe-else-if": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-empty": "error",
"no-empty-character-class": "error",
"no-empty-pattern": "error",
"no-empty-static-block": "error",
"no-ex-assign": "error",
"no-extra-boolean-cast": "error",
"no-fallthrough": "error",
"no-func-assign": "error",
"no-global-assign": "error",
"no-import-assign": "error",
"no-invalid-regexp": "error",
"no-irregular-whitespace": "error",
"no-loss-of-precision": "error",
"no-misleading-character-class": "error",
"no-new-native-nonconstructor": "error",
"no-nonoctal-decimal-escape": "error",
"no-obj-calls": "error",
"no-prototype-builtins": "error",
"no-redeclare": "error",
"no-regex-spaces": "error",
"no-self-assign": "error",
"no-setter-return": "error",
"no-shadow-restricted-names": "error",
"no-sparse-arrays": "error",
"no-this-before-super": "error",
"no-unassigned-vars": "error",
"no-unexpected-multiline": "error",
"no-unreachable": "error",
"no-unsafe-finally": "error",
"no-unsafe-negation": "error",
"no-unsafe-optional-chaining": "error",
"no-unused-labels": "error",
"no-unused-private-class-members": "error",
"no-unused-vars": [
"error",
{
"args": "all",
"argsIgnorePattern": "^_",
"caughtErrors": "all",
"caughtErrorsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
],
"no-useless-backreference": "error",
"no-useless-catch": "error",
"no-useless-escape": "error",
"no-with": "error",
"preserve-caught-error": "error",
"require-yield": "error",
"use-isnan": "error",
"valid-typeof": "error",
"no-array-constructor": "error",
"no-unused-expressions": "error",
"typescript/ban-ts-comment": "error",
"typescript/no-duplicate-enum-values": "error",
"typescript/no-empty-object-type": "error",
"typescript/no-explicit-any": "error",
"typescript/no-extra-non-null-assertion": "error",
"typescript/no-misused-new": "error",
"typescript/no-namespace": "error",
"typescript/no-non-null-asserted-optional-chain": "error",
"typescript/no-require-imports": "error",
"typescript/no-this-alias": "error",
"typescript/no-unnecessary-type-constraint": "error",
"typescript/no-unsafe-declaration-merging": "error",
"typescript/no-unsafe-function-type": "error",
"typescript/no-wrapper-object-types": "error",
"typescript/prefer-as-const": "error",
"typescript/prefer-namespace-keyword": "error",
"typescript/triple-slash-reference": "error"
},
"overrides": [
{
"files": ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
"rules": {
"constructor-super": "off",
"getter-return": "off",
"no-class-assign": "off",
"no-const-assign": "off",
"no-dupe-class-members": "off",
"no-dupe-keys": "off",
"no-func-assign": "off",
"no-import-assign": "off",
"no-new-native-nonconstructor": "off",
"no-obj-calls": "off",
"no-redeclare": "off",
"no-setter-return": "off",
"no-this-before-super": "off",
"no-unreachable": "off",
"no-unsafe-negation": "off",
"no-var": "error",
"no-with": "off",
"prefer-const": "error",
"prefer-rest-params": "error",
"prefer-spread": "error"
}
}
]
}
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pnpm-lock.yaml
**/CHANGELOG.md
**/CHANGELOG.md
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
"recommendations": ["esbenp.prettier-vscode"]
}
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<br>
<br>
Tooling to give you full type-safety around OpenAPI specs.

</div>

<br>
Expand Down Expand Up @@ -205,9 +205,7 @@ the `@openapi-codegen/cli` supports these generator plugins:
generate all schema types for your specification:

```ts
const { schemasFiles } = await generateSchemaTypes(context, {
/* config */
});
const { schemasFiles } = await generateSchemaTypes(context, {/* config */});
```

output: `{namespace}Schemas.ts`
Expand Down
38 changes: 17 additions & 21 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,33 +34,29 @@
"README.md"
],
"dependencies": {
"@clack/prompts": "^0.9.1",
"@octokit/request": "^9.2.2",
"@swc/core": "^1.2.118",
"@clack/prompts": "^1.8.1",
"@octokit/request": "^10.0.16",
"@swc/core": "^1.16.13",
"case": "^1.6.3",
"cli-highlight": "^2.1.11",
"clipanion": "^4.0.0-rc.4",
"fs-extra": "^10.0.0",
"got": "^12.0.0",
"got-fetch": "^5.1.1",
"js-yaml": "^4.1.0",
"openapi3-ts": "^4.4.0",
"prettier": "^3.2.5",
"slash": "^4.0.0",
"fs-extra": "^11.4.1",
"got": "^16.0.0",
"js-yaml": "^5.4.3",
"openapi3-ts": "^4.6.1",
"prettier": "^3.9.9",
"slash": "^5.1.0",
"swagger2openapi": "^7.0.8",
"tslib": "^2.3.1",
"tslib": "^2.8.1",
"typanion": "^3.14.0",
"typescript": "5.7.3"
"typescript": "~6.0.2"
},
"devDependencies": {
"@swc-node/register": "^1.4.0",
"@types/fs-extra": "^9.0.13",
"@types/js-yaml": "^4.0.3",
"@types/nock": "^11.1.0",
"@types/prettier": "^3.0.0",
"@types/slash": "^3.0.0",
"nock": "^13.2.1",
"react": "^18.3.1",
"tsup": "^8.3.5"
"@swc-node/register": "^1.12.1",
"@types/fs-extra": "^11.0.4",
"@types/js-yaml": "^4.0.9",
"nock": "^15.0.1",
"react": "^19.3.0",
"tsup": "^8.5.1"
}
}
4 changes: 4 additions & 0 deletions cli/src/commands/InitCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ export class InitCommand extends Command {
message: "Relative path",
placeholder: "./openapi.json",
validate(value) {
if (value === undefined) return "No relative path provided";

if (!value.startsWith("./") && !value.startsWith("../"))
return "The path should be relative";

Expand All @@ -132,6 +134,8 @@ export class InitCommand extends Command {
message: "Url",
placeholder: "https://.../openapi.json",
validate(value) {
if (value === undefined) return "No Url provided";

if (!value.startsWith("https://") && !value.startsWith("http://")) {
return "Url must starts with http or https protocol";
}
Expand Down
4 changes: 1 addition & 3 deletions cli/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,4 @@ export type Import = {
};

export type Plugin =
| "typescript/types-only"
| "typescript/react-query"
| "typescript/fetch";
"typescript/types-only" | "typescript/react-query" | "typescript/fetch";
5 changes: 3 additions & 2 deletions cli/src/utils/handlePromptCancel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isCancel, cancel } from "@clack/prompts";
import { isCancel, cancel, CANCEL_SYMBOL } from "@clack/prompts";

/**
* Handle the cancellation case for clark’s prompts.
Expand All @@ -11,10 +11,11 @@ import { isCancel, cancel } from "@clack/prompts";
* @param value Any value coming from a cancellable clark prompt
* @returns
*/
export async function handlePromptCancel<T>(value: T | symbol) {
export async function handlePromptCancel<T>(value: T | typeof CANCEL_SYMBOL) {
if (isCancel(value)) {
cancel("Operation cancelled! See you later 😁✌️");
process.exit(0);
}

return value;
}
3 changes: 0 additions & 3 deletions cli/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"baseUrl": "./"
},
"include": ["src/**/*"]
}
3 changes: 2 additions & 1 deletion cli/tsconfig.package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "lib"
"outDir": "lib",
"rootDir": "./src"
},
"files": ["src/index.ts"],
"include": ["src/types/**/*"]
Expand Down
27 changes: 0 additions & 27 deletions eslint.config.mjs

This file was deleted.

16 changes: 8 additions & 8 deletions examples/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
"gen:github": "openapi-codegen gen github"
},
"dependencies": {
"@tanstack/react-query": "5.66.0",
"react": "19.0.0",
"react-dom": "19.0.0"
"@tanstack/react-query": "5.104.1",
"react": "19.3.0",
"react-dom": "19.3.0"
},
"devDependencies": {
"@openapi-codegen/cli": "workspace:*",
"@openapi-codegen/typescript": "workspace:*",
"@types/react": "19.0.8",
"@types/react-dom": "19.0.3",
"@vitejs/plugin-react": "4.3.4",
"typescript": "5.7.3",
"vite": "6.0.11"
"@types/react": "19.3.0",
"@types/react-dom": "19.3.0",
"@vitejs/plugin-react": "6.1.2",
"typescript": "~6.0.2",
"vite": "8.3.3"
}
}
Loading
Loading