fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #118 from hey-api/docs/rename

docs(README): update name references

authored by

Lubos and committed by
GitHub
88611d3f 39f21bba

+32 -37
+1 -1
CONTRIBUTING.md
··· 1 - # Contributing to OpenAPI TypeScript Codegen 1 + # Contributing to OpenAPI TypeScript 👋 2 2 3 3 Thanks for your interest in contributing to this project. 4 4
+16 -16
README.md
··· 1 - # OpenAPI TypeScript Codegen 1 + # OpenAPI TypeScript 👋 2 2 3 3 > ✨ Turn your OpenAPI specification into a beautiful TypeScript client 4 4 ··· 17 17 18 18 ## About 19 19 20 - This is an opinionated fork of the [openapi-typescript-codegen](https://github.com/ferdikoomen/openapi-typescript-codegen) package. We created it after the original project became [unmaintained](https://github.com/ferdikoomen/openapi-typescript-codegen/issues/1276#issuecomment-1302392146) because we wanted to support OpenAPI v3.1 introduced in the FastAPI [v0.99.0](https://fastapi.tiangolo.com/release-notes/#0990) release. We plan to resolve the most pressing issues in the original project – open an issue if you'd like to prioritise your use case! 20 + `openapi-ts` started as a fork of [openapi-typescript-codegen](https://github.com/ferdikoomen/openapi-typescript-codegen). We created it after the original project became [unmaintained](https://github.com/ferdikoomen/openapi-typescript-codegen/issues/1276#issuecomment-1302392146) to add support for OpenAPI v3.1. We plan to resolve the most pressing issues in the original project – open an issue if you'd like to prioritise your use case! 21 21 22 22 ## Features 23 23 ··· 33 33 The fastest way to use `openapi-ts` is via npx 34 34 35 35 ```sh 36 - npx @nicolas-chaulet/openapi-typescript-codegen -i path/to/openapi.json -o src/client 36 + npx @hey-api/openapi-ts -i path/to/openapi.json -o src/client 37 37 ``` 38 38 39 39 Congratulations on creating your first client! 🎉 ··· 41 41 ## Installation 42 42 43 43 ```sh 44 - npm install @nicolas-chaulet/openapi-typescript-codegen --save-dev 44 + npm install @hey-api/openapi-ts --save-dev 45 45 ``` 46 46 47 47 or 48 48 49 49 ```sh 50 - yarn add @nicolas-chaulet/openapi-typescript-codegen -D 50 + yarn add @hey-api/openapi-ts -D 51 51 ``` 52 52 53 53 If you want to use `openapi-ts` with CLI, add a script to your `package.json` file ··· 61 61 You can also generate your client programmatically by importing `openapi-ts` in a `.ts` file. 62 62 63 63 ```ts 64 - import { createClient } from '@nicolas-chaulet/openapi-typescript-codegen' 64 + import { createClient } from '@hey-api/openapi-ts' 65 65 66 66 createClient({ 67 67 input: 'path/to/openapi.json', ··· 75 75 76 76 `openapi-ts` supports loading configuration from a file inside your project root directory. You can either create a `openapi-ts.config.cjs` file 77 77 78 - ```js 79 - /** @type {import('@nicolas-chaulet/openapi-typescript-codegen').UserConfig} */ 78 + ```cjs 79 + /** @type {import('@hey-api/openapi-ts').UserConfig} */ 80 80 module.exports = { 81 81 input: 'path/to/openapi.json', 82 82 output: 'src/client', ··· 85 85 86 86 or `openapi-ts.config.mjs` 87 87 88 - ```js 89 - /** @type {import('@nicolas-chaulet/openapi-typescript-codegen').UserConfig} */ 88 + ```mjs 89 + /** @type {import('@hey-api/openapi-ts').UserConfig} */ 90 90 export default { 91 91 input: 'path/to/openapi.json', 92 92 output: 'src/client', ··· 99 99 100 100 By default, `openapi-ts` will automatically format your client according to your project configuration. To disable automatic formatting, set `format` to false 101 101 102 - ```js 103 - /** @type {import('@nicolas-chaulet/openapi-typescript-codegen').UserConfig} */ 102 + ```mjs 103 + /** @type {import('@hey-api/openapi-ts').UserConfig} */ 104 104 export default { 105 105 format: false, 106 106 input: 'path/to/openapi.json', ··· 114 114 115 115 For performance reasons, `openapi-ts` does not automatically lint your client. To enable this feature, set `lint` to true 116 116 117 - ```js 118 - /** @type {import('@nicolas-chaulet/openapi-typescript-codegen').UserConfig} */ 117 + ```mjs 118 + /** @type {import('@hey-api/openapi-ts').UserConfig} */ 119 119 export default { 120 120 input: 'path/to/openapi.json', 121 121 lint: true, ··· 129 129 130 130 We do not generate TypeScript [enums](https://www.typescriptlang.org/docs/handbook/enums.html) because they are not standard JavaScript and pose [typing challenges](https://dev.to/ivanzm123/dont-use-enums-in-typescript-they-are-very-dangerous-57bh). If you want to iterate through possible field values without manually typing arrays, you can export enums by running 131 131 132 - ```js 133 - /** @type {import('@nicolas-chaulet/openapi-typescript-codegen').UserConfig} */ 132 + ```mjs 133 + /** @type {import('@hey-api/openapi-ts').UserConfig} */ 134 134 export default { 135 135 enums: true, 136 136 input: 'path/to/openapi.json',
+2 -2
package-lock.json
··· 1 1 { 2 - "name": "@nicolas-chaulet/openapi-typescript-codegen", 2 + "name": "@hey-api/openapi-ts", 3 3 "version": "0.27.36", 4 4 "lockfileVersion": 3, 5 5 "requires": true, 6 6 "packages": { 7 7 "": { 8 - "name": "@nicolas-chaulet/openapi-typescript-codegen", 8 + "name": "@hey-api/openapi-ts", 9 9 "version": "0.27.36", 10 10 "license": "MIT", 11 11 "dependencies": {
+11 -16
package.json
··· 1 1 { 2 - "name": "@nicolas-chaulet/openapi-typescript-codegen", 2 + "name": "@hey-api/openapi-ts", 3 3 "version": "0.27.36", 4 4 "type": "module", 5 - "description": "Library that generates Typescript clients based on the OpenAPI specification.", 6 - "author": "Ferdi Koomen", 7 - "homepage": "https://github.com/nicolas-chaulet/openapi-typescript-codegen/", 5 + "description": "Turn your OpenAPI specification into a beautiful TypeScript client", 6 + "homepage": "https://github.com/hey-api/openapi-ts/", 8 7 "repository": { 9 8 "type": "git", 10 - "url": "git+https://github.com/nicolas-chaulet/openapi-typescript-codegen.git" 9 + "url": "git+https://github.com/hey-api/openapi-ts.git" 11 10 }, 12 11 "bugs": { 13 - "url": "https://github.com/nicolas-chaulet/openapi-typescript-codegen/issues" 12 + "url": "https://github.com/hey-api/openapi-ts/issues" 14 13 }, 15 14 "license": "MIT", 16 15 "keywords": [ ··· 18 17 "swagger", 19 18 "generator", 20 19 "typescript", 20 + "javascript", 21 + "codegen", 21 22 "yaml", 22 23 "json", 23 24 "fetch", ··· 26 27 "angular", 27 28 "node" 28 29 ], 29 - "maintainers": [ 30 - { 31 - "name": "Ferdi Koomen", 32 - "email": "info@madebyferdi.com" 33 - } 34 - ], 35 30 "main": "./dist/node/index.js", 36 31 "types": "./dist/node/index.d.ts", 37 32 "bin": { ··· 42 37 "dist" 43 38 ], 44 39 "scripts": { 45 - "dev": "rimraf dist && npm run build-bundle -- --watch", 46 - "build": "run-s clean build-bundle build-types", 47 40 "build-bundle": "rollup --config rollup.config.ts --configPlugin typescript", 48 - "build-types": "run-s build-types-temp build-types-roll build-types-check", 49 41 "build-types-check": "tsc --project tsconfig.check.json", 50 42 "build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin typescript && rimraf temp", 51 43 "build-types-temp": "tsc --emitDeclarationOnly --outDir temp -p src/node", 44 + "build-types": "run-s build-types-temp build-types-roll build-types-check", 45 + "build": "run-s clean build-bundle build-types", 52 46 "clean": "rimraf dist test/generated test/e2e/generated coverage node_modules/.cache", 47 + "dev": "rimraf dist && npm run build-bundle -- --watch", 53 48 "lint:fix": "eslint . --fix", 54 49 "lint": "eslint .", 55 50 "prepublishOnly": "npm run build", 56 - "test": "vitest run --config vitest.config.unit.ts", 57 51 "test:coverage": "vitest run --config vitest.config.unit.ts --coverage", 58 52 "test:e2e": "vitest run --config vitest.config.e2e.ts", 59 53 "test:sample": "node test/sample.cjs", 60 54 "test:update": "vitest run --config vitest.config.unit.ts --update", 61 55 "test:watch": "vitest --config vitest.config.unit.ts --watch", 56 + "test": "vitest run --config vitest.config.unit.ts", 62 57 "typecheck": "tsc --noEmit" 63 58 }, 64 59 "engines": {
+2 -2
src/index.spec.ts
··· 21 21 22 22 it('downloads and parses v2 without issues', async () => { 23 23 await createClient({ 24 - input: 'https://raw.githubusercontent.com/ferdikoomen/openapi-typescript-codegen/master/test/spec/v2.json', 24 + input: 'https://raw.githubusercontent.com/hey-api/openapi-ts/main/test/spec/v2.json', 25 25 output: './generated/v2-downloaded/', 26 26 write: false, 27 27 }); ··· 29 29 30 30 it('downloads and parses v3 without issues', async () => { 31 31 await createClient({ 32 - input: 'https://raw.githubusercontent.com/ferdikoomen/openapi-typescript-codegen/master/test/spec/v3.json', 32 + input: 'https://raw.githubusercontent.com/hey-api/openapi-ts/main/test/spec/v3.json', 33 33 output: './generated/v3-downloaded/', 34 34 write: false, 35 35 });