@skmtc/core 0.0.368 → 0.0.370

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 (83) hide show
  1. package/esm/context/GenerateContext.d.ts +79 -4
  2. package/esm/context/GenerateContext.d.ts.map +1 -1
  3. package/esm/context/GenerateContext.js +113 -33
  4. package/esm/deps/jsr.io/@std/io/{0.224.7 → 0.224.8}/types.d.ts +56 -5
  5. package/esm/deps/jsr.io/@std/io/0.224.8/types.d.ts.map +1 -0
  6. package/esm/deps/jsr.io/@std/io/0.224.8/types.js +15 -0
  7. package/esm/deps/jsr.io/@std/io/{0.224.7 → 0.224.8}/write_all.d.ts.map +1 -1
  8. package/esm/deps/jsr.io/@std/log/0.224.7/file_handler.js +1 -1
  9. package/esm/oas/array/Array.d.ts +32 -8
  10. package/esm/oas/array/Array.d.ts.map +1 -1
  11. package/esm/oas/array/Array.js +60 -30
  12. package/esm/oas/boolean/Boolean.d.ts +24 -6
  13. package/esm/oas/boolean/Boolean.d.ts.map +1 -1
  14. package/esm/oas/boolean/Boolean.js +40 -24
  15. package/esm/oas/integer/Integer.d.ts +29 -8
  16. package/esm/oas/integer/Integer.d.ts.map +1 -1
  17. package/esm/oas/integer/Integer.js +57 -30
  18. package/esm/oas/number/Number.d.ts +24 -6
  19. package/esm/oas/number/Number.d.ts.map +1 -1
  20. package/esm/oas/number/Number.js +40 -24
  21. package/esm/oas/object/Object.d.ts +56 -12
  22. package/esm/oas/object/Object.d.ts.map +1 -1
  23. package/esm/oas/object/Object.js +52 -5
  24. package/esm/oas/string/String.d.ts +32 -8
  25. package/esm/oas/string/String.d.ts.map +1 -1
  26. package/esm/oas/string/String.js +63 -33
  27. package/esm/oas/union/Union.d.ts +38 -8
  28. package/esm/oas/union/Union.d.ts.map +1 -1
  29. package/esm/oas/union/Union.js +66 -30
  30. package/esm/oas/unknown/Unknown.d.ts +24 -5
  31. package/esm/oas/unknown/Unknown.d.ts.map +1 -1
  32. package/esm/oas/unknown/Unknown.js +34 -21
  33. package/esm/oas/void/Void.d.ts +22 -5
  34. package/esm/oas/void/Void.d.ts.map +1 -1
  35. package/esm/oas/void/Void.js +32 -21
  36. package/esm/server/createServer.d.ts.map +1 -1
  37. package/esm/server/createServer.js +9 -6
  38. package/package.json +1 -1
  39. package/script/context/GenerateContext.d.ts +79 -4
  40. package/script/context/GenerateContext.d.ts.map +1 -1
  41. package/script/context/GenerateContext.js +113 -33
  42. package/script/deps/jsr.io/@std/io/{0.224.7 → 0.224.8}/types.d.ts +56 -5
  43. package/script/deps/jsr.io/@std/io/0.224.8/types.d.ts.map +1 -0
  44. package/script/deps/jsr.io/@std/io/0.224.8/types.js +18 -0
  45. package/script/deps/jsr.io/@std/io/{0.224.7 → 0.224.8}/write_all.d.ts.map +1 -1
  46. package/script/deps/jsr.io/@std/log/0.224.7/file_handler.js +1 -1
  47. package/script/oas/array/Array.d.ts +32 -8
  48. package/script/oas/array/Array.d.ts.map +1 -1
  49. package/script/oas/array/Array.js +60 -30
  50. package/script/oas/boolean/Boolean.d.ts +24 -6
  51. package/script/oas/boolean/Boolean.d.ts.map +1 -1
  52. package/script/oas/boolean/Boolean.js +40 -24
  53. package/script/oas/integer/Integer.d.ts +29 -8
  54. package/script/oas/integer/Integer.d.ts.map +1 -1
  55. package/script/oas/integer/Integer.js +57 -30
  56. package/script/oas/number/Number.d.ts +24 -6
  57. package/script/oas/number/Number.d.ts.map +1 -1
  58. package/script/oas/number/Number.js +40 -24
  59. package/script/oas/object/Object.d.ts +56 -12
  60. package/script/oas/object/Object.d.ts.map +1 -1
  61. package/script/oas/object/Object.js +52 -5
  62. package/script/oas/string/String.d.ts +32 -8
  63. package/script/oas/string/String.d.ts.map +1 -1
  64. package/script/oas/string/String.js +63 -33
  65. package/script/oas/union/Union.d.ts +38 -8
  66. package/script/oas/union/Union.d.ts.map +1 -1
  67. package/script/oas/union/Union.js +66 -30
  68. package/script/oas/unknown/Unknown.d.ts +24 -5
  69. package/script/oas/unknown/Unknown.d.ts.map +1 -1
  70. package/script/oas/unknown/Unknown.js +34 -21
  71. package/script/oas/void/Void.d.ts +22 -5
  72. package/script/oas/void/Void.d.ts.map +1 -1
  73. package/script/oas/void/Void.js +32 -21
  74. package/script/server/createServer.d.ts.map +1 -1
  75. package/script/server/createServer.js +9 -6
  76. package/esm/deps/jsr.io/@std/io/0.224.7/types.d.ts.map +0 -1
  77. package/esm/deps/jsr.io/@std/io/0.224.7/types.js +0 -3
  78. package/script/deps/jsr.io/@std/io/0.224.7/types.d.ts.map +0 -1
  79. package/script/deps/jsr.io/@std/io/0.224.7/types.js +0 -4
  80. /package/esm/deps/jsr.io/@std/io/{0.224.7 → 0.224.8}/write_all.d.ts +0 -0
  81. /package/esm/deps/jsr.io/@std/io/{0.224.7 → 0.224.8}/write_all.js +0 -0
  82. /package/script/deps/jsr.io/@std/io/{0.224.7 → 0.224.8}/write_all.d.ts +0 -0
  83. /package/script/deps/jsr.io/@std/io/{0.224.7 → 0.224.8}/write_all.js +0 -0
@@ -1,48 +1,80 @@
1
+ /**
2
+ * Object representing an object and/or a record in the OpenAPI Specification.
3
+ *
4
+ * Objects have fixed, named fields. Records have any number of fields that do not have predefined names.
5
+ */
1
6
  export class OasObject {
2
7
  constructor(fields) {
8
+ /**
9
+ * Object is part the 'schema' set which is used
10
+ * to define data types in an OpenAPI document.
11
+ */
3
12
  Object.defineProperty(this, "oasType", {
4
13
  enumerable: true,
5
14
  configurable: true,
6
15
  writable: true,
7
16
  value: 'schema'
8
17
  });
18
+ /**
19
+ * Constant value 'object' useful for type narrowing and tagged unions.
20
+ */
9
21
  Object.defineProperty(this, "type", {
10
22
  enumerable: true,
11
23
  configurable: true,
12
24
  writable: true,
13
25
  value: 'object'
14
26
  });
27
+ /**
28
+ * A short summary of the object.
29
+ */
15
30
  Object.defineProperty(this, "title", {
16
31
  enumerable: true,
17
32
  configurable: true,
18
33
  writable: true,
19
34
  value: void 0
20
35
  });
36
+ /**
37
+ * A description of the object.
38
+ */
21
39
  Object.defineProperty(this, "description", {
22
40
  enumerable: true,
23
41
  configurable: true,
24
42
  writable: true,
25
43
  value: void 0
26
44
  });
27
- Object.defineProperty(this, "properties", {
45
+ /**
46
+ * Indicates whether value can be null.
47
+ */
48
+ Object.defineProperty(this, "nullable", {
28
49
  enumerable: true,
29
50
  configurable: true,
30
51
  writable: true,
31
52
  value: void 0
32
53
  });
33
- Object.defineProperty(this, "required", {
54
+ /**
55
+ * A record which maps property names of the object to their schemas.
56
+ */
57
+ Object.defineProperty(this, "properties", {
34
58
  enumerable: true,
35
59
  configurable: true,
36
60
  writable: true,
37
61
  value: void 0
38
62
  });
39
- Object.defineProperty(this, "additionalProperties", {
63
+ /**
64
+ * An array of required property names.
65
+ */
66
+ Object.defineProperty(this, "required", {
40
67
  enumerable: true,
41
68
  configurable: true,
42
69
  writable: true,
43
70
  value: void 0
44
71
  });
45
- Object.defineProperty(this, "nullable", {
72
+ /**
73
+ * Indicates whether additional properties are allowed.
74
+ *
75
+ * This is equivalent to a Record type in TypeScript.
76
+ */
77
+ Object.defineProperty(this, "additionalProperties", {
46
78
  enumerable: true,
47
79
  configurable: true,
48
80
  writable: true,
@@ -62,6 +94,15 @@ export class OasObject {
62
94
  required: []
63
95
  });
64
96
  }
97
+ /**
98
+ * Adds a new property to the object.
99
+ *
100
+ * @param {AddPropertyArgs} args - The arguments for adding a property.
101
+ * @param {string} args.name - The name of the property to add.
102
+ * @param {OasSchema | OasRef<'schema'> | CustomValue | undefined} args.schema - The schema of the property to add.
103
+ * @param {boolean} args.required - Whether the property is required.
104
+ * @returns {OasObject} A new OasObject with the added property.
105
+ */
65
106
  addProperty({ name, schema, required }) {
66
107
  if (!schema) {
67
108
  return this;
@@ -78,7 +119,13 @@ export class OasObject {
78
119
  nullable: this.nullable
79
120
  });
80
121
  }
81
- removeProperty({ name }) {
122
+ /**
123
+ * Removes a property from the object.
124
+ *
125
+ * @param {string} name - The name of the property to remove.
126
+ * @returns {OasObject} A new OasObject with the removed property.
127
+ */
128
+ removeProperty(name) {
82
129
  if (!this.properties?.[name]) {
83
130
  return this;
84
131
  }
@@ -6,18 +6,42 @@ export type StringFields = {
6
6
  enums?: string[];
7
7
  nullable?: boolean;
8
8
  };
9
+ /**
10
+ * Object representing a string in the OpenAPI Specification.
11
+ */
9
12
  export declare class OasString {
10
- #private;
11
- oasType: 'schema';
12
- type: 'string';
13
+ /**
14
+ * Object is part the 'schema' set which is used
15
+ * to define data types in an OpenAPI document.
16
+ */
17
+ oasType: "schema";
18
+ /**
19
+ * Constant value 'string' useful for type narrowing and tagged unions.
20
+ */
21
+ type: "string";
22
+ /**
23
+ * A short summary of the string.
24
+ */
25
+ title: string | undefined;
26
+ /**
27
+ * A description of the string.
28
+ */
29
+ description: string | undefined;
30
+ /**
31
+ * The format of the string.
32
+ */
33
+ format: string | undefined;
34
+ /**
35
+ * An array of allowed values for the string.
36
+ */
37
+ enums: string[] | undefined;
38
+ /**
39
+ * Indicates whether value can be null.
40
+ */
41
+ nullable: boolean | undefined;
13
42
  constructor(fields: StringFields);
14
- get title(): string | undefined;
15
- get description(): string | undefined;
16
- get nullable(): boolean | undefined;
17
43
  isRef(): this is OasRef<'schema'>;
18
44
  resolve(): OasString;
19
45
  resolveOnce(): OasString;
20
- get format(): string | undefined;
21
- get enums(): string[] | undefined;
22
46
  }
23
47
  //# sourceMappingURL=String.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"String.d.ts","sourceRoot":"","sources":["../../../src/oas/string/String.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CA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AAY;IAYhC,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC;IAIjC,OAAO,IAAI,SAAS;IAIpB,WAAW,IAAI,SAAS;CAGzB"}
@@ -1,41 +1,81 @@
1
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
- if (kind === "m") throw new TypeError("Private method is not writable");
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
- };
7
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
- };
12
- var _OasString_fields;
1
+ /**
2
+ * Object representing a string in the OpenAPI Specification.
3
+ */
13
4
  export class OasString {
14
5
  constructor(fields) {
6
+ /**
7
+ * Object is part the 'schema' set which is used
8
+ * to define data types in an OpenAPI document.
9
+ */
15
10
  Object.defineProperty(this, "oasType", {
16
11
  enumerable: true,
17
12
  configurable: true,
18
13
  writable: true,
19
14
  value: 'schema'
20
15
  });
16
+ /**
17
+ * Constant value 'string' useful for type narrowing and tagged unions.
18
+ */
21
19
  Object.defineProperty(this, "type", {
22
20
  enumerable: true,
23
21
  configurable: true,
24
22
  writable: true,
25
23
  value: 'string'
26
24
  });
27
- _OasString_fields.set(this, void 0);
28
- __classPrivateFieldSet(this, _OasString_fields, fields, "f");
29
- }
30
- get title() {
31
- return __classPrivateFieldGet(this, _OasString_fields, "f").title;
32
- }
33
- get description() {
34
- return __classPrivateFieldGet(this, _OasString_fields, "f").description;
35
- }
36
- get nullable() {
37
- return __classPrivateFieldGet(this, _OasString_fields, "f").nullable;
25
+ /**
26
+ * A short summary of the string.
27
+ */
28
+ Object.defineProperty(this, "title", {
29
+ enumerable: true,
30
+ configurable: true,
31
+ writable: true,
32
+ value: void 0
33
+ });
34
+ /**
35
+ * A description of the string.
36
+ */
37
+ Object.defineProperty(this, "description", {
38
+ enumerable: true,
39
+ configurable: true,
40
+ writable: true,
41
+ value: void 0
42
+ });
43
+ /**
44
+ * The format of the string.
45
+ */
46
+ Object.defineProperty(this, "format", {
47
+ enumerable: true,
48
+ configurable: true,
49
+ writable: true,
50
+ value: void 0
51
+ });
52
+ /**
53
+ * An array of allowed values for the string.
54
+ */
55
+ Object.defineProperty(this, "enums", {
56
+ enumerable: true,
57
+ configurable: true,
58
+ writable: true,
59
+ value: void 0
60
+ });
61
+ /**
62
+ * Indicates whether value can be null.
63
+ */
64
+ Object.defineProperty(this, "nullable", {
65
+ enumerable: true,
66
+ configurable: true,
67
+ writable: true,
68
+ value: void 0
69
+ });
70
+ this.title = fields.title;
71
+ this.description = fields.description;
72
+ this.format = fields.format;
73
+ this.enums = fields.enums;
74
+ this.nullable = fields.nullable;
38
75
  }
76
+ // get pattern() {
77
+ // return this.fields.pattern
78
+ // }
39
79
  isRef() {
40
80
  return false;
41
81
  }
@@ -45,14 +85,4 @@ export class OasString {
45
85
  resolveOnce() {
46
86
  return this;
47
87
  }
48
- get format() {
49
- return __classPrivateFieldGet(this, _OasString_fields, "f").format;
50
- }
51
- // get pattern() {
52
- // return this.fields.pattern
53
- // }
54
- get enums() {
55
- return __classPrivateFieldGet(this, _OasString_fields, "f").enums;
56
- }
57
88
  }
58
- _OasString_fields = new WeakMap();
@@ -8,16 +8,46 @@ export type UnionFields = {
8
8
  discriminator?: OasDiscriminator;
9
9
  members: (OasSchema | OasRef<'schema'>)[];
10
10
  };
11
+ /**
12
+ * Object representing a 'oneOf' or 'anyOf' in the OpenAPI Specification.
13
+ *
14
+ * In the context of TypeScript 'anyOf' is not helpful since it implies
15
+ * a union that consists of all possible combinations of member types.
16
+ *
17
+ * Generating such combination types would not be useful and we map both
18
+ * 'oneOf' and 'anyOf' to a TypeScript union type.
19
+ */
11
20
  export declare class OasUnion {
12
- #private;
13
- oasType: 'schema';
14
- type: 'union';
21
+ /**
22
+ * Object is part the 'schema' set which is used
23
+ * to define data types in an OpenAPI document.
24
+ */
25
+ oasType: "schema";
26
+ /**
27
+ * Constant value 'union' useful for type narrowing and tagged unions.
28
+ */
29
+ type: "union";
30
+ /**
31
+ * A short summary of the union.
32
+ */
33
+ title: string | undefined;
34
+ /**
35
+ * A description of the union.
36
+ */
37
+ description: string | undefined;
38
+ /**
39
+ * Indicates whether value can be null.
40
+ */
41
+ nullable: boolean | undefined;
42
+ /**
43
+ * Discriminator object used to tag member types and make the union a tagged union.
44
+ */
45
+ discriminator: OasDiscriminator | undefined;
46
+ /**
47
+ * Array of schemas or references to schemas that are part of the union.
48
+ */
49
+ members: (OasSchema | OasRef<'schema'>)[];
15
50
  constructor(fields: UnionFields);
16
- get title(): string | undefined;
17
- get description(): string | undefined;
18
- get discriminator(): OasDiscriminator | undefined;
19
- get members(): (OasSchema | OasRef<'schema'>)[];
20
- get nullable(): boolean | undefined;
21
51
  isRef(): this is OasRef<'schema'>;
22
52
  resolve(): OasUnion;
23
53
  resolveOnce(): OasUnion;
@@ -1 +1 @@
1
- {"version":3,"file":"Union.d.ts","sourceRoot":"","sources":["../../../src/oas/union/Union.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CA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3B;;OAEG;IACH,IAAI,UAAmB;IACvB;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B;;OAEG;IACH,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B;;OAEG;IACH,aAAa,EAAE,gBAAgB,GAAG,SAAS,CAAA;IAC3C;;OAEG;IACH,OAAO,EAAE,CAAC,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAA;gBAE7B,MAAM,EAAE,WAAW;IAQ/B,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC;IAIjC,OAAO,IAAI,QAAQ;IAInB,WAAW,IAAI,QAAQ;CAGxB"}
@@ -1,46 +1,83 @@
1
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
- if (kind === "m") throw new TypeError("Private method is not writable");
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
- };
7
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
- };
12
- var _OasUnion_fields;
1
+ /**
2
+ * Object representing a 'oneOf' or 'anyOf' in the OpenAPI Specification.
3
+ *
4
+ * In the context of TypeScript 'anyOf' is not helpful since it implies
5
+ * a union that consists of all possible combinations of member types.
6
+ *
7
+ * Generating such combination types would not be useful and we map both
8
+ * 'oneOf' and 'anyOf' to a TypeScript union type.
9
+ */
13
10
  export class OasUnion {
14
11
  constructor(fields) {
12
+ /**
13
+ * Object is part the 'schema' set which is used
14
+ * to define data types in an OpenAPI document.
15
+ */
15
16
  Object.defineProperty(this, "oasType", {
16
17
  enumerable: true,
17
18
  configurable: true,
18
19
  writable: true,
19
20
  value: 'schema'
20
21
  });
22
+ /**
23
+ * Constant value 'union' useful for type narrowing and tagged unions.
24
+ */
21
25
  Object.defineProperty(this, "type", {
22
26
  enumerable: true,
23
27
  configurable: true,
24
28
  writable: true,
25
29
  value: 'union'
26
30
  });
27
- _OasUnion_fields.set(this, void 0);
28
- __classPrivateFieldSet(this, _OasUnion_fields, fields, "f");
29
- }
30
- get title() {
31
- return __classPrivateFieldGet(this, _OasUnion_fields, "f").title;
32
- }
33
- get description() {
34
- return __classPrivateFieldGet(this, _OasUnion_fields, "f").description;
35
- }
36
- get discriminator() {
37
- return __classPrivateFieldGet(this, _OasUnion_fields, "f").discriminator;
38
- }
39
- get members() {
40
- return __classPrivateFieldGet(this, _OasUnion_fields, "f").members;
41
- }
42
- get nullable() {
43
- return __classPrivateFieldGet(this, _OasUnion_fields, "f").nullable;
31
+ /**
32
+ * A short summary of the union.
33
+ */
34
+ Object.defineProperty(this, "title", {
35
+ enumerable: true,
36
+ configurable: true,
37
+ writable: true,
38
+ value: void 0
39
+ });
40
+ /**
41
+ * A description of the union.
42
+ */
43
+ Object.defineProperty(this, "description", {
44
+ enumerable: true,
45
+ configurable: true,
46
+ writable: true,
47
+ value: void 0
48
+ });
49
+ /**
50
+ * Indicates whether value can be null.
51
+ */
52
+ Object.defineProperty(this, "nullable", {
53
+ enumerable: true,
54
+ configurable: true,
55
+ writable: true,
56
+ value: void 0
57
+ });
58
+ /**
59
+ * Discriminator object used to tag member types and make the union a tagged union.
60
+ */
61
+ Object.defineProperty(this, "discriminator", {
62
+ enumerable: true,
63
+ configurable: true,
64
+ writable: true,
65
+ value: void 0
66
+ });
67
+ /**
68
+ * Array of schemas or references to schemas that are part of the union.
69
+ */
70
+ Object.defineProperty(this, "members", {
71
+ enumerable: true,
72
+ configurable: true,
73
+ writable: true,
74
+ value: void 0
75
+ });
76
+ this.title = fields.title;
77
+ this.description = fields.description;
78
+ this.nullable = fields.nullable;
79
+ this.discriminator = fields.discriminator;
80
+ this.members = fields.members;
44
81
  }
45
82
  isRef() {
46
83
  return false;
@@ -52,4 +89,3 @@ export class OasUnion {
52
89
  return this;
53
90
  }
54
91
  }
55
- _OasUnion_fields = new WeakMap();
@@ -3,13 +3,32 @@ export type UnknownFields = {
3
3
  title?: string;
4
4
  description?: string;
5
5
  };
6
+ /**
7
+ * Object representing an unknown type in the OpenAPI Specification.
8
+ *
9
+ * JSON schema treats a definition without any type information as 'any'.
10
+ * Since this is not useful in an API context, we use OasUnknown to
11
+ * represent types that are not specified.
12
+ */
6
13
  export declare class OasUnknown {
7
- #private;
8
- oasType: 'schema';
9
- type: 'unknown';
14
+ /**
15
+ * Object is part the 'schema' set which is used
16
+ * to define data types in an OpenAPI document.
17
+ */
18
+ oasType: "schema";
19
+ /**
20
+ * Constant value 'unknown' useful for type narrowing and tagged unions.
21
+ */
22
+ type: "unknown";
23
+ /**
24
+ * A short summary of the unknown type.
25
+ */
26
+ title: string | undefined;
27
+ /**
28
+ * A description of the unknown type.
29
+ */
30
+ description: string | undefined;
10
31
  constructor(fields: UnknownFields);
11
- get title(): string | undefined;
12
- get description(): string | undefined;
13
32
  isRef(): this is OasRef<'schema'>;
14
33
  resolve(): OasUnknown;
15
34
  resolveOnce(): OasUnknown;
@@ -1 +1 @@
1
- {"version":3,"file":"Unknown.d.ts","sourceRoot":"","sources":["../../../src/oas/unknown/Unknown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,qBAAa,UAAU;;IACrB,OAAO,EAAE,QAAQ,CAAW;IAC5B,IAAI,EAAE,SAAS,CAAY;gBAGf,MAAM,EAAE,aAAa;IAIjC,IAAI,KAAK,IAAI,MAAM,GAAG,SAAS,CAE9B;IAED,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC;IAIjC,OAAO,IAAI,UAAU;IAIrB,WAAW,IAAI,UAAU;CAG1B"}
1
+ {"version":3,"file":"Unknown.d.ts","sourceRoot":"","sources":["../../../src/oas/unknown/Unknown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED;;;;;;GAMG;AACH,qBAAa,UAAU;IACrB;;;OAGG;IACH,OAAO,WAAoB;IAC3B;;OAEG;IACH,IAAI,YAAqB;IACzB;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;gBAEnB,MAAM,EAAE,aAAa;IAKjC,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC;IAIjC,OAAO,IAAI,UAAU;IAIrB,WAAW,IAAI,UAAU;CAG1B"}
@@ -1,37 +1,51 @@
1
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
- if (kind === "m") throw new TypeError("Private method is not writable");
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
- };
7
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
- };
12
- var _OasUnknown_fields;
1
+ /**
2
+ * Object representing an unknown type in the OpenAPI Specification.
3
+ *
4
+ * JSON schema treats a definition without any type information as 'any'.
5
+ * Since this is not useful in an API context, we use OasUnknown to
6
+ * represent types that are not specified.
7
+ */
13
8
  export class OasUnknown {
14
9
  constructor(fields) {
10
+ /**
11
+ * Object is part the 'schema' set which is used
12
+ * to define data types in an OpenAPI document.
13
+ */
15
14
  Object.defineProperty(this, "oasType", {
16
15
  enumerable: true,
17
16
  configurable: true,
18
17
  writable: true,
19
18
  value: 'schema'
20
19
  });
20
+ /**
21
+ * Constant value 'unknown' useful for type narrowing and tagged unions.
22
+ */
21
23
  Object.defineProperty(this, "type", {
22
24
  enumerable: true,
23
25
  configurable: true,
24
26
  writable: true,
25
27
  value: 'unknown'
26
28
  });
27
- _OasUnknown_fields.set(this, void 0);
28
- __classPrivateFieldSet(this, _OasUnknown_fields, fields, "f");
29
- }
30
- get title() {
31
- return __classPrivateFieldGet(this, _OasUnknown_fields, "f").title;
32
- }
33
- get description() {
34
- return __classPrivateFieldGet(this, _OasUnknown_fields, "f").description;
29
+ /**
30
+ * A short summary of the unknown type.
31
+ */
32
+ Object.defineProperty(this, "title", {
33
+ enumerable: true,
34
+ configurable: true,
35
+ writable: true,
36
+ value: void 0
37
+ });
38
+ /**
39
+ * A description of the unknown type.
40
+ */
41
+ Object.defineProperty(this, "description", {
42
+ enumerable: true,
43
+ configurable: true,
44
+ writable: true,
45
+ value: void 0
46
+ });
47
+ this.title = fields.title;
48
+ this.description = fields.description;
35
49
  }
36
50
  isRef() {
37
51
  return false;
@@ -43,4 +57,3 @@ export class OasUnknown {
43
57
  return this;
44
58
  }
45
59
  }
46
- _OasUnknown_fields = new WeakMap();
@@ -3,14 +3,31 @@ export type VoidFields = {
3
3
  title?: string;
4
4
  description?: string;
5
5
  };
6
+ /**
7
+ * Object representing a void type in the OpenAPI Specification.
8
+ * It is used to describe an absence of a value such as when no
9
+ * content is returned by an operation.
10
+ */
6
11
  export declare class OasVoid {
7
- #private;
8
- oasType: 'schema';
9
- type: 'void';
12
+ /**
13
+ * Object is part the 'schema' set which is used
14
+ * to define data types in an OpenAPI document.
15
+ */
16
+ oasType: "schema";
17
+ /**
18
+ * Constant value 'void' useful for type narrowing and tagged unions.
19
+ */
20
+ type: "void";
21
+ /**
22
+ * A short summary of the value.
23
+ */
24
+ title: string | undefined;
25
+ /**
26
+ * A description of the value.
27
+ */
28
+ description: string | undefined;
10
29
  constructor(fields?: VoidFields);
11
30
  static empty(): OasVoid;
12
- get title(): string | undefined;
13
- get description(): string | undefined;
14
31
  isRef(): this is OasRef<'schema'>;
15
32
  resolve(): OasVoid;
16
33
  resolveOnce(): OasVoid;
@@ -1 +1 @@
1
- {"version":3,"file":"Void.d.ts","sourceRoot":"","sources":["../../../src/oas/void/Void.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,qBAAa,OAAO;;IAClB,OAAO,EAAE,QAAQ,CAAW;IAC5B,IAAI,EAAE,MAAM,CAAS;gBAGT,MAAM,GAAE,UAAe;IAInC,MAAM,CAAC,KAAK,IAAI,OAAO;IAIvB,IAAI,KAAK,IAAI,MAAM,GAAG,SAAS,CAE9B;IAED,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC;IAIjC,OAAO,IAAI,OAAO;IAIlB,WAAW,IAAI,OAAO;CAGvB"}
1
+ {"version":3,"file":"Void.d.ts","sourceRoot":"","sources":["../../../src/oas/void/Void.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED;;;;GAIG;AACH,qBAAa,OAAO;IAClB;;;OAGG;IACH,OAAO,WAAoB;IAC3B;;OAEG;IACH,IAAI,SAAkB;IACtB;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;gBAEnB,MAAM,GAAE,UAAe;IAKnC,MAAM,CAAC,KAAK,IAAI,OAAO;IAIvB,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC;IAIjC,OAAO,IAAI,OAAO;IAIlB,WAAW,IAAI,OAAO;CAGvB"}