@ng-openapi/zod 0.0.9 → 0.0.10

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 (4) hide show
  1. package/README.md +34 -34
  2. package/index.cjs +16 -12
  3. package/index.js +16 -12
  4. package/package.json +79 -79
package/README.md CHANGED
@@ -36,14 +36,14 @@ npm install @ng-openapi/zod ng-openapi --save-dev
36
36
 
37
37
  ```typescript
38
38
  // openapi.config.ts
39
- import { GeneratorConfig } from 'ng-openapi';
40
- import { HttpResourcePlugin } from '@ng-openapi/zod';
39
+ import { GeneratorConfig } from "ng-openapi";
40
+ import { HttpResourcePlugin } from "@ng-openapi/zod";
41
41
 
42
42
  export default {
43
- input: './swagger.json',
44
- output: './src/api',
45
- clientName: 'NgOpenApi',
46
- plugins: [HttpResourcePlugin],
43
+ input: "./swagger.json",
44
+ output: "./src/api",
45
+ clientName: "NgOpenApi",
46
+ plugins: [HttpResourcePlugin],
47
47
  } as GeneratorConfig;
48
48
  ```
49
49
 
@@ -57,45 +57,45 @@ ng-openapi -c openapi.config.ts
57
57
 
58
58
  ```typescript
59
59
  // app.config.ts
60
- import { ApplicationConfig } from '@angular/core';
61
- import { provideDefaultClient } from './api/providers';
60
+ import { ApplicationConfig } from "@angular/core";
61
+ import { provideDefaultClient } from "./api/providers";
62
62
 
63
63
  export const appConfig: ApplicationConfig = {
64
- providers: [
65
- provideNgOpenApiClient({
66
- basePath: 'https://api.example.com'
67
- })
68
- ]
64
+ providers: [
65
+ provideNgOpenApiClient({
66
+ basePath: "https://api.example.com",
67
+ }),
68
+ ],
69
69
  };
70
70
  ```
71
71
 
72
72
  ### 4. Use Generated Resources
73
73
 
74
74
  ```typescript
75
- import { Component, inject } from '@angular/core';
76
- import { UsersResource } from './api/resources';
75
+ import { Component, inject } from "@angular/core";
76
+ import { UsersResource } from "./api/resources";
77
77
 
78
78
  @Component({
79
- selector: 'app-users',
80
- template: `
81
- <div>
82
- @if (users.isLoading()) {
83
- <p>Loading...</p>
84
- }
85
- @if (users.error()) {
86
- <p>Error: {{ users.error() }}</p>
87
- }
88
- @for (user of users.value(); track user.id) {
89
- <div>{{ user.name }}</div>
90
- }
91
- </div>
92
- `
79
+ selector: "app-users",
80
+ template: `
81
+ <div>
82
+ @if (users.isLoading()) {
83
+ <p>Loading...</p>
84
+ }
85
+ @if (users.error()) {
86
+ <p>Error: {{ users.error() }}</p>
87
+ }
88
+ @for (user of users.value(); track user.id) {
89
+ <div>{{ user.name }}</div>
90
+ }
91
+ </div>
92
+ `,
93
93
  })
94
94
  export class UsersComponent {
95
- private readonly usersResource = inject(UsersResource);
96
-
97
- // Automatic caching and reactive updates
98
- readonly users = this.usersResource.getUsers();
95
+ private readonly usersResource = inject(UsersResource);
96
+
97
+ // Automatic caching and reactive updates
98
+ readonly users = this.usersResource.getUsers();
99
99
  }
100
100
  ```
101
101
 
@@ -115,4 +115,4 @@ src/api/
115
115
  ## Documentation
116
116
 
117
117
  - 📖 [Full Documentation](https://ng-openapi.dev/plugins/zod)
118
- - 🚀 [Live Examples](https://stackblitz.com/@Mr-Jami/collections/ng-openapi-examples)
118
+ - 🚀 [Live Examples](https://stackblitz.com/@Mr-Jami/collections/ng-openapi-examples)
package/index.cjs CHANGED
@@ -1060,6 +1060,19 @@ function charFromCodepoint(c) {
1060
1060
  );
1061
1061
  }
1062
1062
  __name(charFromCodepoint, "charFromCodepoint");
1063
+ function setProperty(object, key, value) {
1064
+ if (key === "__proto__") {
1065
+ Object.defineProperty(object, key, {
1066
+ configurable: true,
1067
+ enumerable: true,
1068
+ writable: true,
1069
+ value
1070
+ });
1071
+ } else {
1072
+ object[key] = value;
1073
+ }
1074
+ }
1075
+ __name(setProperty, "setProperty");
1063
1076
  var simpleEscapeCheck = new Array(256);
1064
1077
  var simpleEscapeMap = new Array(256);
1065
1078
  for (i = 0; i < 256; i++) {
@@ -1184,7 +1197,7 @@ function mergeMappings(state, destination, source, overridableKeys) {
1184
1197
  for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
1185
1198
  key = sourceKeys[index];
1186
1199
  if (!_hasOwnProperty$1.call(destination, key)) {
1187
- destination[key] = source[key];
1200
+ setProperty(destination, key, source[key]);
1188
1201
  overridableKeys[key] = true;
1189
1202
  }
1190
1203
  }
@@ -1225,16 +1238,7 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu
1225
1238
  state.position = startPos || state.position;
1226
1239
  throwError(state, "duplicated mapping key");
1227
1240
  }
1228
- if (keyNode === "__proto__") {
1229
- Object.defineProperty(_result, keyNode, {
1230
- configurable: true,
1231
- enumerable: true,
1232
- writable: true,
1233
- value: valueNode
1234
- });
1235
- } else {
1236
- _result[keyNode] = valueNode;
1237
- }
1241
+ setProperty(_result, keyNode, valueNode);
1238
1242
  delete overridableKeys[keyNode];
1239
1243
  }
1240
1244
  return _result;
@@ -3491,6 +3495,6 @@ var ZodGenerator = class {
3491
3495
  /*! Bundled license information:
3492
3496
 
3493
3497
  js-yaml/dist/js-yaml.mjs:
3494
- (*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT *)
3498
+ (*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
3495
3499
  */
3496
3500
  //# sourceMappingURL=index.cjs.map
package/index.js CHANGED
@@ -1026,6 +1026,19 @@ function charFromCodepoint(c) {
1026
1026
  );
1027
1027
  }
1028
1028
  __name(charFromCodepoint, "charFromCodepoint");
1029
+ function setProperty(object, key, value) {
1030
+ if (key === "__proto__") {
1031
+ Object.defineProperty(object, key, {
1032
+ configurable: true,
1033
+ enumerable: true,
1034
+ writable: true,
1035
+ value
1036
+ });
1037
+ } else {
1038
+ object[key] = value;
1039
+ }
1040
+ }
1041
+ __name(setProperty, "setProperty");
1029
1042
  var simpleEscapeCheck = new Array(256);
1030
1043
  var simpleEscapeMap = new Array(256);
1031
1044
  for (i = 0; i < 256; i++) {
@@ -1150,7 +1163,7 @@ function mergeMappings(state, destination, source, overridableKeys) {
1150
1163
  for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
1151
1164
  key = sourceKeys[index];
1152
1165
  if (!_hasOwnProperty$1.call(destination, key)) {
1153
- destination[key] = source[key];
1166
+ setProperty(destination, key, source[key]);
1154
1167
  overridableKeys[key] = true;
1155
1168
  }
1156
1169
  }
@@ -1191,16 +1204,7 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu
1191
1204
  state.position = startPos || state.position;
1192
1205
  throwError(state, "duplicated mapping key");
1193
1206
  }
1194
- if (keyNode === "__proto__") {
1195
- Object.defineProperty(_result, keyNode, {
1196
- configurable: true,
1197
- enumerable: true,
1198
- writable: true,
1199
- value: valueNode
1200
- });
1201
- } else {
1202
- _result[keyNode] = valueNode;
1203
- }
1207
+ setProperty(_result, keyNode, valueNode);
1204
1208
  delete overridableKeys[keyNode];
1205
1209
  }
1206
1210
  return _result;
@@ -3456,6 +3460,6 @@ export {
3456
3460
  /*! Bundled license information:
3457
3461
 
3458
3462
  js-yaml/dist/js-yaml.mjs:
3459
- (*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT *)
3463
+ (*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
3460
3464
  */
3461
3465
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,84 +1,84 @@
1
1
  {
2
- "name": "@ng-openapi/zod",
3
- "version": "0.0.9",
4
- "description": "Zod validation plugin for ng-openapi - Generate Zod schemas from OpenAPI specifications",
5
- "keywords": [
6
- "angular",
7
- "ng-openapi",
8
- "plugin",
9
- "zod",
10
- "validation",
11
- "schema",
12
- "typescript",
13
- "openapi"
14
- ],
15
- "author": {
16
- "name": "Tareq Jami",
17
- "email": "info@jami-it.de",
18
- "url": "http://tareqjami.de"
19
- },
20
- "license": "MIT",
21
- "homepage": "https://ng-openapi.dev/guide/zod",
22
- "bugs": {
23
- "url": "https://github.com/ng-openapi/ng-openapi/issues"
24
- },
25
- "repository": {
26
- "type": "git",
27
- "url": "git+https://github.com/ng-openapi/ng-openapi.git",
28
- "directory": "packages/plugins/zod"
29
- },
30
- "funding": {
31
- "type": "github",
32
- "url": "https://github.com/sponsors/ng-openapi"
33
- },
34
- "type": "module",
35
- "main": "./index.js",
36
- "module": "./index.js",
37
- "types": "./index.d.ts",
38
- "exports": {
39
- ".": {
40
- "types": "./index.d.ts",
41
- "import": "./index.js",
42
- "require": "./index.cjs"
43
- }
44
- },
45
- "files": [
46
- "index.js",
47
- "index.cjs",
48
- "index.d.ts",
49
- "lib/**/*.js",
50
- "lib/**/*.cjs",
51
- "lib/**/*.d.ts",
52
- "README.md",
53
- "LICENSE",
54
- "CHANGELOG.md"
55
- ],
56
- "scripts": {
57
- "prepublishOnly": "echo 'Build the package using: npm run build:zod from workspace root'",
58
- "build": "tsup"
59
- },
60
- "peerDependencies": {
61
- "ng-openapi": ">=0.2",
62
- "ts-morph": "*",
63
- "zod": ">=4"
64
- },
65
- "peerDependenciesMeta": {
66
- "ng-openapi": {
67
- "optional": false
2
+ "name": "@ng-openapi/zod",
3
+ "version": "0.0.10",
4
+ "description": "Zod validation plugin for ng-openapi - Generate Zod schemas from OpenAPI specifications",
5
+ "keywords": [
6
+ "angular",
7
+ "ng-openapi",
8
+ "plugin",
9
+ "zod",
10
+ "validation",
11
+ "schema",
12
+ "typescript",
13
+ "openapi"
14
+ ],
15
+ "author": {
16
+ "name": "Tareq Jami",
17
+ "email": "info@jami-it.de",
18
+ "url": "http://tareqjami.de"
19
+ },
20
+ "license": "MIT",
21
+ "homepage": "https://ng-openapi.dev/guide/zod",
22
+ "bugs": {
23
+ "url": "https://github.com/ng-openapi/ng-openapi/issues"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/ng-openapi/ng-openapi.git",
28
+ "directory": "packages/plugins/zod"
29
+ },
30
+ "funding": {
31
+ "type": "github",
32
+ "url": "https://github.com/sponsors/ng-openapi"
33
+ },
34
+ "type": "module",
35
+ "main": "./index.js",
36
+ "module": "./index.js",
37
+ "types": "./index.d.ts",
38
+ "exports": {
39
+ ".": {
40
+ "types": "./index.d.ts",
41
+ "import": "./index.js",
42
+ "require": "./index.cjs"
43
+ }
44
+ },
45
+ "files": [
46
+ "index.js",
47
+ "index.cjs",
48
+ "index.d.ts",
49
+ "lib/**/*.js",
50
+ "lib/**/*.cjs",
51
+ "lib/**/*.d.ts",
52
+ "README.md",
53
+ "LICENSE",
54
+ "CHANGELOG.md"
55
+ ],
56
+ "scripts": {
57
+ "prepublishOnly": "echo 'Build the package using: npm run build:zod from workspace root'",
58
+ "build": "tsup"
59
+ },
60
+ "peerDependencies": {
61
+ "ng-openapi": ">=0.2",
62
+ "ts-morph": "*",
63
+ "zod": ">=4"
64
+ },
65
+ "peerDependenciesMeta": {
66
+ "ng-openapi": {
67
+ "optional": false
68
+ },
69
+ "ts-morph": {
70
+ "optional": false
71
+ },
72
+ "zod": {
73
+ "optional": false
74
+ }
68
75
  },
69
- "ts-morph": {
70
- "optional": false
76
+ "engines": {
77
+ "node": ">=20.0.0",
78
+ "npm": ">=8.0.0"
71
79
  },
72
- "zod": {
73
- "optional": false
80
+ "publishConfig": {
81
+ "access": "public",
82
+ "registry": "https://registry.npmjs.org/"
74
83
  }
75
- },
76
- "engines": {
77
- "node": ">=20.0.0",
78
- "npm": ">=8.0.0"
79
- },
80
- "publishConfig": {
81
- "access": "public",
82
- "registry": "https://registry.npmjs.org/"
83
- }
84
84
  }