open-index/open-npm huggingface dataset:
npm package: @principlestudios/openapi-codegen-typescript
Description: A typescript client code generator for principled development
Author: Matt DeKrey & Principle Studios
Latest version: 0.9.0

# OpenAPI Codegen for a TypeScript-friendly Open API clients

Uses [Microsoft.OpenApi.Readers][1] along with custom templates in order to
generate generalized TypeScript objects for creating clients of many shapes.
Delivered via an npm package.

```sh
npm i -D @principlestudios/openapi-codegen-typescript
```

You must also have `dotnet` 8.0 runtime installed on your machine.

This will provide a corresponding bin to generate the typescript files.

```sh
openapi-codegen-typescript api.yaml api-generated/ -c
```

The above example will take as input an `api.yaml`, output an `api-generated/`
folder with all the typescript files and a gitignore. You should add this as
part of your CI process with only the OpenAPI spec checked in, or download the
spec as part of the CI process.

Written in C#.

[1]: https://www.nuget.org/packages/Microsoft.OpenApi.Readers
npm package: @principlestudios/openapi-codegen-typescript-axios
Description: A typescript client code generator for principled development using Axios
Author: Matt DeKrey
Latest version: 0.0.2
Deprecated: No longer supported.

# OpenAPI Codegen for a TypeScript-friendly Axios client

Uses [OpenAPITools/openapi-generator][1] along with custom templates in order to
generate a TypeScript Axios client. Delivered via an npm package.

    npm i -D @principlestudios/openapi-codegen-typescript-axios

This will also include `@openapitools/openapi-generator-cli`, which adds a bin.

    openapi-generator generate -i api.yaml -o api-generated/ -g typescript-axios -t node_modules/@principlestudios/openapi-codegen-typescript-axios/templates

The above example will take as input an `api.yaml`, output an `api-generated/`
folder with all the typescript files and a gitignore. You should add this as
part of your CI process with only the OpenAPI spec checked in, or download the
spec as part of the CI process.

# Working with this source code

This packages only new templates, tests via Jest (to be consistent with
the snapshot tests we do elsewhere in this repository), and delivers via npm (for easy
use for the C# projects for which this is designed) to work with the existing
`@openapitools/openapi-generator-cli` npm package.

Prerequisites:

    Node/npm

No build needed!

To update Jest snapshots: (pay attention to slash types, it's important)

    npm test -- -u

To package:

    npm pack

[1]: https://github.com/OpenAPITools/openapi-generator
npm package: @principlestudios/openapi-codegen-typescript-fetch
Description: A typescript code generator for principled development using the fetch API
Author: Matt DeKrey
Latest version: 0.7.1

# OpenAPI Codegen for a TypeScript-friendly Fetch client

Provides an adapter layer method for
[@principlestudios/openapi-codegen-typescript][1] to integrate with fetch.

    npm i -D @principlestudios/openapi-codegen-typescript-fetch

You must also have `dotnet` 7.0 runtime installed on your machine.

This will provide a corresponding bin to generate the typescript files.

    openapi-codegen-typescript api.yaml api-generated/ -c

You can then create an API wrapper such as:

    import { toFetchApi } from '@principlestudios/openapi-codegen-typescript-fetch';
    import operations from './api-generated/operations';

    export default toFetchApi(operations, fetch);

This API will use the type safety from OpenAPI along with `fetch`.

Optionally, a third parameter may be passed to `toFetchApi` to prefix all URLs; do not include the trailing `/`. For instance, if the API is located at `/api/example`, but the OpenAPI endpoint is just `/example`, use `toFetchApi(operations, fetch, '/api')`.

## Use with `node-fetch`

To use with `node-fetch`, the prefix specified must be a fully-qualified URL. For instance, if the API is located at `https://server/api/example`, but the OpenAPI endpoint is just `/example`, use `toFetchApi(operations, fetch, 'https://server/api')`. In addition, if you do not have the "DOM" lib specified in your tsconfig.json, make the following changes:

1. Ensure you have a compatible version of `node-fetch` installed.
2. Add a `types.d.ts` file (or other `.d.ts` file to be picked up by TypeScript in your Node sections) to your project with the following global type declarations:

    ```typescript
    type FormData = typeof import('formdata-polyfill/esm.min.js').FormData;
    type Headers = import('node-fetch').Headers;
    type Blob = NodeJS.ReadableStream;
    ```

[1]: https://www.npmjs.com/package/@principlestudios/openapi-codegen-typescript
npm package: @principlestudios/openapi-codegen-typescript-msw
Description: A typescript code generator for principled development to assist with testing using MSW
Author: Matt DeKrey
Latest version: 0.7.0

# OpenAPI Codegen for TypeScript-friendly MSW testing

Provides an adapter layer method for
[@principlestudios/openapi-codegen-typescript][1] to integrate with msw.

```sh
npm i -D @principlestudios/openapi-codegen-typescript-msw
```

You must also have `dotnet` 8.0 runtime installed on your machine.

This will provide a corresponding bin to generate the typescript files.

```sh
openapi-codegen-typescript api.yaml api-generated/ -c
```

You can then create a mock MSW service to handle specific requests:

```ts
import { setupServer } from 'msw/node';
import { toMswHandler } from '@principlestudios/openapi-codegen-typescript-msw';
import operations from './api-generated/operations';

const baseDomain = 'http://localhost/';
const findPets = toMswHandler(operations.findPets, { baseDomain });
const server = setupServer(
    findPets(
        { params: { tags: ['dog','cat'], limit: 10 } },
        { statusCode: 200, data: [{ name: 'Fido', tag: 'dog', id: 1234 }], mimeType: 'application/json' }
    )
);
```

This API will use the type safety from OpenAPI along with msw.

[1]: https://www.npmjs.com/package/@principlestudios/openapi-codegen-typescript
npm package: @principlestudios/openapi-codegen-typescript-rxjs
Description: A typescript client code generator for principled development using RxJS
Author: Matt DeKrey
Latest version: 0.7.0

# OpenAPI Codegen for a TypeScript-friendly RxJS client

Provides an adapter layer method for
[@principlestudios/openapi-codegen-typescript][1] to integrate with rxjs.

```sh
npm i -D @principlestudios/openapi-codegen-typescript-rxjs
```

You must also have `dotnet` 8.0 runtime installed on your machine.

This will provide a corresponding bin to generate the typescript files.

```sh
openapi-codegen-typescript api.yaml api-generated/ -c
```

You can then create an API wrapper such as:

```ts
import { toRxjsApi } from '@principlestudios/openapi-codegen-typescript-rxjs';
import operations from './api-generated/operations';

const baseDomain = 'http://localhost/';
export default toRxjsApi(operations, baseDomain);
```

To use within node (such as unit tests), use the `universal-rxjs-ajax` npm module:

```ts
import { toRxjsApi } from '@principlestudios/openapi-codegen-typescript-rxjs';
import operations from './api-generated/operations';
import { request as ajax } from 'universal-rxjs-ajax';

const baseDomain = 'http://localhost/';
export default toRxjsApi(operations, baseDomain, ajax);
```

This API will use the type safety from OpenAPI along with rxjs.

[1]: https://www.npmjs.com/package/@principlestudios/openapi-codegen-typescript