{"id":35595692,"url":"https://github.com/yhnavein/swaggie","last_synced_at":"2026-04-02T15:06:32.394Z","repository":{"id":45879344,"uuid":"120893123","full_name":"yhnavein/swaggie","owner":"yhnavein","description":"Tool for generating TypeScript client code for given Swagger API endpoints","archived":false,"fork":false,"pushed_at":"2026-03-10T22:05:47.000Z","size":1340,"stargazers_count":24,"open_issues_count":0,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-03-11T03:09:15.745Z","etag":null,"topics":["code-generation","codegen","nswag","oas3","openapi","openapi3","rest-api","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/swaggie","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yhnavein.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-02-09T10:37:44.000Z","updated_at":"2026-02-25T22:57:31.000Z","dependencies_parsed_at":"2024-06-21T00:20:06.818Z","dependency_job_id":"1fb1608b-8b4a-4e41-b1c3-54a51535d1a4","html_url":"https://github.com/yhnavein/swaggie","commit_stats":{"total_commits":344,"total_committers":25,"mean_commits":13.76,"dds":"0.40116279069767447","last_synced_commit":"cba4f9aaf253a0e2d6027e1576c5be0cd53c8c80"},"previous_names":[],"tags_count":76,"template":false,"template_full_name":null,"purl":"pkg:github/yhnavein/swaggie","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yhnavein%2Fswaggie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yhnavein%2Fswaggie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yhnavein%2Fswaggie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yhnavein%2Fswaggie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yhnavein","download_url":"https://codeload.github.com/yhnavein/swaggie/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yhnavein%2Fswaggie/sbom","scorecard":{"id":114235,"data":{"date":"2025-07-07","repo":{"name":"github.com/yhnavein/swaggie","commit":"ca178a60205bd044713dcb1d3198d2910bfefedc"},"scorecard":{"version":"v5.2.1-18-gbb9c347d","commit":"bb9c347dff6349d986baab6578a46d68a5524c62"},"score":3.6,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/13 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/node.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/yhnavein/swaggie/node.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/yhnavein/swaggie/node.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 18 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":8,"reason":"2 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cxrh-j4jr-qwg3"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-15T23:37:21.190Z","repository_id":45879344,"created_at":"2025-08-15T23:37:21.191Z","updated_at":"2025-08-15T23:37:21.191Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30410366,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T00:40:14.898Z","status":"ssl_error","status_checked_at":"2026-03-12T00:40:08.439Z","response_time":84,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-generation","codegen","nswag","oas3","openapi","openapi3","rest-api","typescript"],"created_at":"2026-01-05T00:17:57.125Z","updated_at":"2026-04-02T15:06:32.379Z","avatar_url":"https://github.com/yhnavein.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv style=\"text-align: center; margin: 0px auto 30px; max-width: 600px\"\u003e\n  \u003cimg src=\"./docs/public/swaggie-full.png\" alt=\"Swaggie logo\"\u003e\n\u003c/div\u003e\n\n# Swaggie\n\n![npm latest version](https://img.shields.io/npm/v/swaggie)\n![NodeCI](https://github.com/yhnavein/swaggie/workflows/NodeCI/badge.svg)\n![Test Coverage](https://img.shields.io/badge/test_coverage-98%25-brightgreen)\n![npm downloads](https://img.shields.io/npm/dw/swaggie.svg)\n![npm install size](https://packagephobia.now.sh/badge?p=swaggie)\n\nSwaggie generates TypeScript client code from an OpenAPI 3 specification. Instead of writing API-fetching code by hand, you point Swaggie at your API spec and it outputs a fully typed, ready-to-use client — helping you catch errors at compile time rather than at runtime.\n\nSee the [Example section](#example) for a quick demo, or visit the full documentation at **[yhnavein.github.io/swaggie](https://yhnavein.github.io/swaggie/)** for guides, configuration reference, and an interactive playground.\n\n\u003e Inspired by [OpenApi Client](https://github.com/mikestead/openapi-client).\n\n---\n\n## Features\n\n- Generates TypeScript code from OpenAPI 3.0, 3.1, and 3.2 specs\n- Supports multiple HTTP client libraries out of the box: `fetch`, `axios`, `xior`, `SWR + axios`, `Angular 1`, `Angular 2+`, and `TanStack Query`\n- Custom templates — bring your own to fit your existing codebase\n- Supports `allOf`, `oneOf`, `anyOf`, `$ref`, nullable types, and various enum definitions\n- Handles multiple content types: JSON, plain text, multipart/form-data, URL-encoded, and binary\n- JSDoc comments on all generated functions\n- Generates a single, small, tree-shakable output file\n- Dev-only dependency — zero runtime overhead\n\n---\n\n## Installation\n\nInstall as a dev dependency in your project:\n\n```bash\nnpm install swaggie --save-dev\n```\n\nOr install globally to use from anywhere:\n\n```bash\nnpm install swaggie -g\n```\n\n---\n\n## OpenAPI Version Support\n\nSwaggie supports **OpenAPI 3.0 and newer**. OpenAPI 2.0 (Swagger) is not supported.\n\nIf your backend still produces a 2.0 spec, you have a few options:\n\n- **(Recommended)** Update your backend to generate an OpenAPI 3.0 spec instead\n- Convert your 2.0 spec to 3.0 using [swagger2openapi](https://www.npmjs.com/package/swagger2openapi)\n- Stay on `Swaggie v0.x` if upgrading is not currently possible\n\n---\n\n## Quick Start\n\n### CLI\n\nRun Swaggie from the command line:\n\n```bash\nswaggie -s https://petstore3.swagger.io/api/v3/openapi.json -o ./client/petstore.ts\n```\n\n**Available options:**\n\n```\n-V, --version              Output the version number\n-c, --config \u003cpath\u003e        Path to a JSON configuration file\n-s, --src \u003curl|path\u003e       URL or file path to the OpenAPI spec\n-o, --out \u003cfilePath\u003e       Output file path (omit to print to stdout)\n-b, --baseUrl \u003cstring\u003e     Default base URL for the generated client (default: \"\")\n-t, --template \u003cstring\u003e    Template to use for code generation (default: \"axios\")\n-m, --mode \u003cmode\u003e          Generation mode: \"full\" or \"schemas\" (default: \"full\")\n-d, --schemaStyle \u003cstyle\u003e  Schema object style: \"interface\" or \"type\" (default: \"interface\")\n    --enumStyle \u003cstyle\u003e    Enum style for plain string enums: \"union\" or \"enum\" (default: \"union\")\n    --enumNamesStyle \u003cs\u003e   Enum member name casing: \"original\" or \"PascalCase\" (default: \"original\")\n    --dateFormat \u003cformat\u003e  Date handling in schemas: \"Date\" or \"string\"\n    --nullables \u003cstrategy\u003e Nullable handling: \"include\", \"nullableAsOptional\", or \"ignore\"\n    --preferAny            Use \"any\" instead of \"unknown\" for untyped values (default: false)\n    --skipDeprecated       Exclude deprecated operations from the output (default: false)\n    --servicePrefix        Prefix for service names — useful when generating multiple APIs\n    --allowDots            Use dot notation to serialize nested object query params\n    --arrayFormat          How arrays are serialized: \"indices\", \"repeat\", or \"brackets\"\n-h, --help                 Show help\n```\n\n### Formatting the Output\n\nSwaggie produces functional TypeScript, but the formatting is not always perfect. It is recommended to pipe the output through a formatter. For example, using Prettier:\n\n```bash\nswaggie -s $URL -o ./client/petstore.ts \u0026\u0026 prettier ./client/petstore.ts --write\n```\n\nThis can be added as an `npm` script in your project for easy re-generation.\n\n---\n\n## Configuration File\n\nFor anything beyond a one-off run, a configuration file is the cleaner approach. Create a JSON file with your settings and pass it via `-c`:\n\n```bash\nswaggie -c swaggie.config.json\n```\n\n**Example configuration:**\n\n```json\n{\n  \"$schema\": \"https://raw.githubusercontent.com/yhnavein/swaggie/master/schema.json\",\n  \"src\": \"https://petstore3.swagger.io/api/v3/openapi.json\",\n  \"out\": \"./src/client/petstore.ts\",\n  \"template\": \"axios\",\n  \"baseUrl\": \"/api\",\n  \"preferAny\": true,\n  \"servicePrefix\": \"\",\n  \"dateFormat\": \"Date\",\n  \"nullableStrategy\": \"ignore\",\n  \"generationMode\": \"full\",\n  \"schemaDeclarationStyle\": \"interface\",\n  \"enumDeclarationStyle\": \"union\",\n  \"enumNamesStyle\": \"original\",\n  \"queryParamsSerialization\": {\n    \"arrayFormat\": \"repeat\",\n    \"allowDots\": true\n  }\n}\n```\n\nThe `$schema` field enables autocompletion and inline documentation in most editors.\n\n---\n\n## Templates\n\nSwaggie ships with the following built-in templates:\n\n| Template    | Description                                                                               |\n| ----------- | ----------------------------------------------------------------------------------------- |\n| `axios`     | Default. Recommended for React, Vue, and similar frameworks                               |\n| `xior`      | Lightweight modern alternative to axios ([xior](https://github.com/suhaotian/xior#intro)) |\n| `swr-axios` | SWR hooks for GET requests, backed by axios                                               |\n| `tsq-xior`  | TanStack Query hooks for GET requests, backed by xior                                     |\n| `fetch`     | Uses the native browser Fetch API                                                         |\n| `ng1`       | Angular 1 client                                                                          |\n| `ng2`       | Angular 2+ client (uses HttpClient and InjectionTokens)                                   |\n\nTo use a custom template, pass the path to your template directory:\n\n```bash\nswaggie -s https://petstore3.swagger.io/api/v3/openapi.json -o ./client/petstore.ts --template ./my-swaggie-template/\n```\n\n---\n\n## Example\n\nLet's say you're building a TypeScript client for the [PetStore API](https://petstore3.swagger.io). Instead of writing fetch calls by hand, run:\n\n```bash\nswaggie -s https://petstore3.swagger.io/api/v3/openapi.json -o ./api/petstore.ts \u0026\u0026 prettier ./api/petstore.ts --write\n```\n\nSwaggie will generate something like this:\n\n```typescript\n// ./api/petstore.ts\n\nimport Axios, { AxiosPromise } from 'axios';\n\nconst axios = Axios.create({\n  baseURL: '/api',\n  paramsSerializer: (params) =\u003e\n    encodeParams(params, null, {\n      allowDots: true,\n      arrayFormat: 'repeat',\n    }),\n});\n\n/** [...] **/\n\nexport const petClient = {\n  /**\n   * @param petId\n   */\n  getPetById(petId: number): AxiosPromise\u003cPet\u003e {\n    let url = `/pet/${encodeURIComponent(`${petId}`)}`;\n\n    return axios.request\u003cPet\u003e({\n      url: url,\n      method: 'GET',\n    });\n  },\n\n  // ... and other methods ...\n};\n```\n\nYou can then use it directly in your application code:\n\n```typescript\n// app.ts\n\nimport { petClient } from './api/petstore';\n\npetClient.getPetById(123).then((pet) =\u003e console.log('Pet: ', pet));\n```\n\nIf the API removes an endpoint you rely on, re-running Swaggie will cause a **compile-time error** — not a runtime surprise for your users.\n\n---\n\n## Advanced Configuration\n\n### Query Parameter Serialization\n\nDifferent backends expect query parameters in different formats. Swaggie lets you control this via the `queryParamsSerialization` config. The default values match what ASP.NET Core expects.\n\nHere's how the object `{ \"a\": { \"b\": 1 }, \"c\": [2, 3] }` is serialized under each combination:\n\n| Result                  | `allowDots` | `arrayFormat` |\n| ----------------------- | ----------- | ------------- |\n| `?a.b=1\u0026c=2\u0026c=3`        | `true`      | `repeat`      |\n| `?a.b=1\u0026c[]=2\u0026c[]=3`    | `true`      | `brackets`    |\n| `?a.b=1\u0026c[0]=2\u0026c[1]=3`  | `true`      | `indices`     |\n| `?a[b]=1\u0026c=2\u0026c=3`       | `false`     | `repeat`      |\n| `?a[b]=1\u0026c[]=2\u0026c[]=3`   | `false`     | `brackets`    |\n| `?a[b]=1\u0026c[0]=2\u0026c[1]=3` | `false`     | `indices`     |\n\nOnce you identify what your backend expects, update your config:\n\n```json\n{\n  \"queryParamsSerialization\": {\n    \"arrayFormat\": \"repeat\",\n    \"allowDots\": true\n  }\n}\n```\n\n### Nullable Strategy\n\nOpenAPI 3.0 allows fields to be marked as `nullable: true`. Swaggie gives you three ways to handle this in the generated TypeScript, via the `nullableStrategy` option:\n\n| Value                  | Behavior                                                              |\n| ---------------------- | --------------------------------------------------------------------- |\n| `\"ignore\"` _(default)_ | `nullable` is ignored — the field is typed as if it were not nullable |\n| `\"include\"`            | Appends `\\| null` to the type (e.g. `string \\| null`)                 |\n| `\"nullableAsOptional\"` | Makes the field optional (`?`) instead of adding `\\| null`            |\n\n**Example** — given `tenant: { type: 'string', nullable: true }` (required):\n\n```typescript\n// nullableStrategy: \"ignore\"            →  tenant: string;\n// nullableStrategy: \"include\"           →  tenant: string | null;\n// nullableStrategy: \"nullableAsOptional\"  →  tenant?: string;\n```\n\n### Generation Mode\n\nUse `generationMode` (or CLI `--mode`) to control what gets generated:\n\n| Value       | Behavior                                                                       |\n| ----------- | ------------------------------------------------------------------------------ |\n| `\"full\"`   | Generates full client code + used schemas (default, existing behavior)         |\n| `\"schemas\"`| Generates only schemas and includes all component schemas by default            |\n\n`\"schemas\"` mode intentionally does not run the used-schema heuristic.\n\n### Schema Declaration Style\n\nUse `schemaDeclarationStyle` (or CLI `--schemaStyle`) to control object schema output:\n\n| Value         | Behavior                                                                 |\n| ------------- | ------------------------------------------------------------------------ |\n| `\"interface\"`| `export interface Tag { ... }` (default)                                |\n| `\"type\"`     | `export type Tag = { ... };`                                             |\n\n### Enum Declaration Style\n\nUse `enumDeclarationStyle` (or CLI `--enumStyle`) for plain string enums:\n- `\"union\"` (default): `export type Status = \"active\" | \"disabled\";`\n- `\"enum\"`: `export enum Status { active = \"active\", disabled = \"disabled\" }`\n\nNote: this applies only to plain string enums. Non-string enums are still emitted as union types.\n\n### Enum Names Style\n\nUse `enumNamesStyle` (or CLI `--enumNamesStyle`) to control the casing of enum member names when `enumDeclarationStyle` is `\"enum\"`:\n- `\"original\"` (default): member names are used exactly as they appear in the spec\n- `\"PascalCase\"`: member names are converted to PascalCase\n\n### `x-ts-type` Extension\n\nAdd `x-ts-type` to any schema in your spec to emit a verbatim TypeScript type string instead of deriving it from the schema definition. This is useful for intersection types, complex mapped types, or any TypeScript construct that cannot be expressed in OpenAPI's type system:\n\n```yaml\nResourceAccess:\n  x-ts-type: \u003e-\n    { items?: { [key: string]: Entry } } \u0026 { [key: string]: boolean | Entry | undefined }\n  type: object   # kept for doc/validation purposes\n```\n\nSwaggie emits exactly:\n```typescript\nexport type ResourceAccess = { items?: { [key: string]: Entry } } \u0026 { [key: string]: boolean | Entry | undefined };\n```\n\n`x-ts-type` takes precedence over all other schema fields, including `$ref`. See the [full documentation](https://yhnavein.github.io/swaggie/guide/advanced#x-ts-type-extension) for more detail.\n\n### Parameter Modifiers\n\nSometimes an API spec marks a parameter as required, but your client handles it in an interceptor and you don't want it cluttering every method signature. Parameter modifiers let you override this globally without touching the spec.\n\n**Example:**\n\n```json\n{\n  \"modifiers\": {\n    \"parameters\": {\n      \"clientId\": \"ignore\",\n      \"orgId\": \"optional\",\n      \"country\": \"required\"\n    }\n  }\n}\n```\n\n- `\"ignore\"` — the parameter is removed from all generated method signatures\n- `\"optional\"` — the parameter becomes optional regardless of what the spec says\n- `\"required\"` — the parameter is always required (generally better to just fix the spec)\n\n### Code Quality\n\nSwaggie's output is functional but not always perfectly formatted, since it uses a templating engine internally. It is strongly recommended to run the output through a formatter to ensure consistent style across regenerations.\n\n**Prettier** (most popular):\n\n```bash\nprettier ./FILE_PATH.ts --write\n```\n\n**Biome** (fast alternative):\n\n```bash\nbiome check ./FILE_PATH.ts --apply-unsafe\n```\n\nEither tool needs to be installed separately and configured for your project.\n\n---\n\n## Using Swaggie Programmatically\n\nYou can also call Swaggie directly from Node.js/bun/deno/etc:\n\n```javascript\nimport swaggie from 'swaggie';\n\nswaggie\n  .genCode({\n    src: 'https://petstore3.swagger.io/api/v3/openapi.json',\n    out: './api/petstore.ts',\n  })\n  .then(complete, error);\n\nfunction complete(spec) {\n  console.info('Service generation complete');\n}\n\nfunction error(e) {\n  console.error(e.toString());\n}\n```\n\n---\n\n## What's Supported\n\n| Supported                                                                      | Not Supported                                        |\n| ------------------------------------------------------------------------------ | ---------------------------------------------------- |\n| OpenAPI 3.0, 3.1, 3.2                                                          | Swagger / OpenAPI 2.0                                |\n| `allOf`, `oneOf`, `anyOf`, `$ref`, external $refs                              | `not` keyword                                        |\n| Spec formats: JSON, YAML                                                       | Very complex query parameter structures              |\n| Extensions: `x-position`, `x-name`, `x-enumNames`, `x-enum-varnames`, `x-ts-type` | Multiple response types (only the first is used)  |\n| Content types: JSON, plain text, multipart/form-data                           | Multiple request body types (only the first is used) |\n| Content types: `application/x-www-form-urlencoded`, `application/octet-stream` | OpenAPI callbacks and webhooks                       |\n| Various enum definition styles, support for additionalProperties               |                                                      |\n| Nullable types, path inheritance, JSDoc descriptions                           |                                                      |\n| Remote URLs and local file paths as spec source                                |                                                      |\n| Grouping by tags, graceful handling of duplicate operation IDs                 |                                                      |\n\n---\n\n## Used By\n\n\u003cdiv style=\"display: flex; gap: 1rem;\"\u003e\n\u003ca href=\"https://www.britishcouncil.org\"\u003e\u003cimg alt=\"British Council\" src=\"./docs/public/used-in/bc-logo.png\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://kpmg.com/\"\u003e\u003cimg alt=\"KPMG\" src=\"./docs/public/used-in/kpmg-logo.png\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://klarna.com/\"\u003e\u003cimg alt=\"Klarna\" src=\"./docs/public/used-in/klarna-logo.png\" /\u003e\u003c/a\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyhnavein%2Fswaggie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyhnavein%2Fswaggie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyhnavein%2Fswaggie/lists"}