Skip to content

Commit

Permalink
Merge pull request #118 from hey-api/docs/rename
Browse files Browse the repository at this point in the history
docs(README): update name references
  • Loading branch information
mrlubos authored Mar 22, 2024
2 parents 39f21bb + 067555a commit 88611d3
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 37 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contributing to OpenAPI TypeScript Codegen
# Contributing to OpenAPI TypeScript 👋

Thanks for your interest in contributing to this project.

Expand Down
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# OpenAPI TypeScript Codegen
# OpenAPI TypeScript 👋

> ✨ Turn your OpenAPI specification into a beautiful TypeScript client
Expand All @@ -17,7 +17,7 @@

## About

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!
`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!

## Features

Expand All @@ -33,21 +33,21 @@ This is an opinionated fork of the [openapi-typescript-codegen](https://github.c
The fastest way to use `openapi-ts` is via npx

```sh
npx @nicolas-chaulet/openapi-typescript-codegen -i path/to/openapi.json -o src/client
npx @hey-api/openapi-ts -i path/to/openapi.json -o src/client
```

Congratulations on creating your first client! 🎉

## Installation

```sh
npm install @nicolas-chaulet/openapi-typescript-codegen --save-dev
npm install @hey-api/openapi-ts --save-dev
```

or

```sh
yarn add @nicolas-chaulet/openapi-typescript-codegen -D
yarn add @hey-api/openapi-ts -D
```

If you want to use `openapi-ts` with CLI, add a script to your `package.json` file
Expand All @@ -61,7 +61,7 @@ If you want to use `openapi-ts` with CLI, add a script to your `package.json` fi
You can also generate your client programmatically by importing `openapi-ts` in a `.ts` file.

```ts
import { createClient } from '@nicolas-chaulet/openapi-typescript-codegen'
import { createClient } from '@hey-api/openapi-ts'

createClient({
input: 'path/to/openapi.json',
Expand All @@ -75,8 +75,8 @@ createClient({

`openapi-ts` supports loading configuration from a file inside your project root directory. You can either create a `openapi-ts.config.cjs` file

```js
/** @type {import('@nicolas-chaulet/openapi-typescript-codegen').UserConfig} */
```cjs
/** @type {import('@hey-api/openapi-ts').UserConfig} */
module.exports = {
input: 'path/to/openapi.json',
output: 'src/client',
Expand All @@ -85,8 +85,8 @@ module.exports = {

or `openapi-ts.config.mjs`

```js
/** @type {import('@nicolas-chaulet/openapi-typescript-codegen').UserConfig} */
```mjs
/** @type {import('@hey-api/openapi-ts').UserConfig} */
export default {
input: 'path/to/openapi.json',
output: 'src/client',
Expand All @@ -99,8 +99,8 @@ Alternatively, you can use `openapi-ts.config.js` and configure the export state

By default, `openapi-ts` will automatically format your client according to your project configuration. To disable automatic formatting, set `format` to false

```js
/** @type {import('@nicolas-chaulet/openapi-typescript-codegen').UserConfig} */
```mjs
/** @type {import('@hey-api/openapi-ts').UserConfig} */
export default {
format: false,
input: 'path/to/openapi.json',
Expand All @@ -114,8 +114,8 @@ You can also prevent your client from being processed by formatters by adding yo

For performance reasons, `openapi-ts` does not automatically lint your client. To enable this feature, set `lint` to true

```js
/** @type {import('@nicolas-chaulet/openapi-typescript-codegen').UserConfig} */
```mjs
/** @type {import('@hey-api/openapi-ts').UserConfig} */
export default {
input: 'path/to/openapi.json',
lint: true,
Expand All @@ -129,8 +129,8 @@ You can also prevent your client from being processed by linters by adding your

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

```js
/** @type {import('@nicolas-chaulet/openapi-typescript-codegen').UserConfig} */
```mjs
/** @type {import('@hey-api/openapi-ts').UserConfig} */
export default {
enums: true,
input: 'path/to/openapi.json',
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 11 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
{
"name": "@nicolas-chaulet/openapi-typescript-codegen",
"name": "@hey-api/openapi-ts",
"version": "0.27.36",
"type": "module",
"description": "Library that generates Typescript clients based on the OpenAPI specification.",
"author": "Ferdi Koomen",
"homepage": "https://github.com/nicolas-chaulet/openapi-typescript-codegen/",
"description": "Turn your OpenAPI specification into a beautiful TypeScript client",
"homepage": "https://github.com/hey-api/openapi-ts/",
"repository": {
"type": "git",
"url": "git+https://github.com/nicolas-chaulet/openapi-typescript-codegen.git"
"url": "git+https://github.com/hey-api/openapi-ts.git"
},
"bugs": {
"url": "https://github.com/nicolas-chaulet/openapi-typescript-codegen/issues"
"url": "https://github.com/hey-api/openapi-ts/issues"
},
"license": "MIT",
"keywords": [
"openapi",
"swagger",
"generator",
"typescript",
"javascript",
"codegen",
"yaml",
"json",
"fetch",
Expand All @@ -26,12 +27,6 @@
"angular",
"node"
],
"maintainers": [
{
"name": "Ferdi Koomen",
"email": "[email protected]"
}
],
"main": "./dist/node/index.js",
"types": "./dist/node/index.d.ts",
"bin": {
Expand All @@ -42,23 +37,23 @@
"dist"
],
"scripts": {
"dev": "rimraf dist && npm run build-bundle -- --watch",
"build": "run-s clean build-bundle build-types",
"build-bundle": "rollup --config rollup.config.ts --configPlugin typescript",
"build-types": "run-s build-types-temp build-types-roll build-types-check",
"build-types-check": "tsc --project tsconfig.check.json",
"build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin typescript && rimraf temp",
"build-types-temp": "tsc --emitDeclarationOnly --outDir temp -p src/node",
"build-types": "run-s build-types-temp build-types-roll build-types-check",
"build": "run-s clean build-bundle build-types",
"clean": "rimraf dist test/generated test/e2e/generated coverage node_modules/.cache",
"dev": "rimraf dist && npm run build-bundle -- --watch",
"lint:fix": "eslint . --fix",
"lint": "eslint .",
"prepublishOnly": "npm run build",
"test": "vitest run --config vitest.config.unit.ts",
"test:coverage": "vitest run --config vitest.config.unit.ts --coverage",
"test:e2e": "vitest run --config vitest.config.e2e.ts",
"test:sample": "node test/sample.cjs",
"test:update": "vitest run --config vitest.config.unit.ts --update",
"test:watch": "vitest --config vitest.config.unit.ts --watch",
"test": "vitest run --config vitest.config.unit.ts",
"typecheck": "tsc --noEmit"
},
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ describe('index', () => {

it('downloads and parses v2 without issues', async () => {
await createClient({
input: 'https://raw.githubusercontent.com/ferdikoomen/openapi-typescript-codegen/master/test/spec/v2.json',
input: 'https://raw.githubusercontent.com/hey-api/openapi-ts/main/test/spec/v2.json',
output: './generated/v2-downloaded/',
write: false,
});
});

it('downloads and parses v3 without issues', async () => {
await createClient({
input: 'https://raw.githubusercontent.com/ferdikoomen/openapi-typescript-codegen/master/test/spec/v3.json',
input: 'https://raw.githubusercontent.com/hey-api/openapi-ts/main/test/spec/v3.json',
output: './generated/v3-downloaded/',
write: false,
});
Expand Down

0 comments on commit 88611d3

Please sign in to comment.