@sdk-it/generic 0.41.0 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +10 -10
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <p align="center">A TypeScript analysis tool for generating OpenAPI specifications from TypeScript code</p>
4
4
 
5
- This package provides tools to analyze TypeScript code and generate OpenAPI specifications from it. It can extract route information, parameter types, and response schemas from your TypeScript codebase.
5
+ Analyzes TypeScript code to generate OpenAPI specifications. Extracts route information, parameter types, and response schemas from your codebase.
6
6
 
7
7
  ## Frameworks specific integrations
8
8
 
@@ -82,7 +82,7 @@ You can customize the operations as well as add more through the `onOperation` f
82
82
 
83
83
  **Use file name as tag**
84
84
 
85
- Assuming your projects structurd like the following where routes are grouped by representivie file names.
85
+ Assuming your project is structured like the following, where routes are grouped by representative file names:
86
86
 
87
87
  ```
88
88
  apps/
@@ -93,7 +93,7 @@ apps/
93
93
  authors.ts
94
94
  ```
95
95
 
96
- Then you can consider the file name as the tag for the operation which means you don't need to specify the tag in the JSDoc comment or only specify the tag if you want to override the default behavior.
96
+ The file name becomes the default tag for each operation. Specify a tag in JSDoc only to override this default.
97
97
 
98
98
  ```typescript
99
99
  import { basename } from 'node:path';
@@ -119,9 +119,9 @@ const { paths, components } = await analyze('apps/backend/tsconfig.app.json', {
119
119
 
120
120
  ### Customizing Type Mappings
121
121
 
122
- The type analysis can be customized to handle types that are not standard in TypeScript, such as `Decimal` from Prisma. The `typesMap` option in the `analyze` function allows you to provide your own type mappings.
122
+ Custom type mappings handle non-standard TypeScript types like Prisma's `Decimal`. Use the `typesMap` option in `analyze` to define your mappings.
123
123
 
124
- The example below shows how to map a `Decimal` type to a `string`.
124
+ The example below maps `Decimal` to `string`.
125
125
 
126
126
  ```typescript
127
127
  import { writeFile } from 'node:fs/promises';
@@ -158,11 +158,11 @@ const spec = {
158
158
  await writeFile('openapi.json', JSON.stringify(spec, null, 2));
159
159
  ```
160
160
 
161
- This configuration ensures that any property with the `Decimal` type is represented as a `string` in the generated OpenAPI specification.
161
+ With this, the generator maps `Decimal` properties to `string` in the OpenAPI specification.
162
162
 
163
163
  ### Referencing external schemas
164
164
 
165
- By default, the analyzer doesn't see beyond the validation schema defined in the validate middleware route handler and expects the schemas to be defined inline.
165
+ By default, the analyzer only sees schemas defined inline in the validate middleware.
166
166
 
167
167
  For instance the following route handler is perfectly valid and will be analyzed correctly.
168
168
 
@@ -229,9 +229,9 @@ app.post(
229
229
  );
230
230
  ```
231
231
 
232
- In this case the analyzer needs to be able to resolve the `authorSchema` reference to generate the correct OpenAPI schema otherwise it will fail.
232
+ The analyzer must resolve the `authorSchema` reference to generate the correct OpenAPI schema. Otherwise it will fail.
233
233
 
234
- Luckily, the analyzer provides an `imports` option that allows you to specify additional files to be included in the analysis.
234
+ The analyzer's `imports` option lets you include additional files in the analysis.
235
235
 
236
236
  ```ts
237
237
  import { join } from 'node:path';
@@ -279,7 +279,7 @@ app.post(
279
279
 
280
280
  ### Control endpoint/operation visibility
281
281
 
282
- You can control the visibility of endpoints and operations in the generated OpenAPI specification by using the `@access` tag in your JSDoc comments. for now only `private` is supported.
282
+ Control endpoint visibility with the `@access` tag in JSDoc comments. For now, only `private` is supported.
283
283
 
284
284
  ```typescript
285
285
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdk-it/generic",
3
- "version": "0.41.0",
3
+ "version": "0.42.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "!**/*.test.*"
23
23
  ],
24
24
  "dependencies": {
25
- "@sdk-it/core": "0.41.0",
25
+ "@sdk-it/core": "0.42.0",
26
26
  "stringcase": "^4.3.1",
27
27
  "debug": "^4.4.0",
28
28
  "openapi3-ts": "^4.4.0"