@skmtc/core 0.40.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 (79) hide show
  1. package/esm/context/GenerateContext.d.ts +1 -1
  2. package/esm/context/GenerateContext.js +4 -3
  3. package/esm/context/ParseContext.d.ts +26 -0
  4. package/esm/context/ParseContext.js +112 -2
  5. package/esm/context/generateTypes.d.ts +16 -2
  6. package/esm/context/generateTypes.js +2 -0
  7. package/esm/context/tryParseAt.d.ts +4 -1
  8. package/esm/context/tryParseAt.js +10 -3
  9. package/esm/helpers/collateExamples.js +15 -5
  10. package/esm/helpers/refFns.d.ts +9 -3
  11. package/esm/helpers/refFns.js +29 -9
  12. package/esm/mod.d.ts +1 -0
  13. package/esm/mod.js +1 -0
  14. package/esm/oas/ref/DanglingRefError.d.ts +22 -0
  15. package/esm/oas/ref/DanglingRefError.js +33 -0
  16. package/esm/oas/ref/Ref.d.ts +5 -0
  17. package/esm/oas/ref/Ref.js +28 -2
  18. package/esm/oas/schema/siblings.js +12 -2
  19. package/esm/oas/union/Union.d.ts +2 -1
  20. package/esm/oas/union/Union.js +23 -12
  21. package/esm/parse/securityRequirements.d.ts +6 -0
  22. package/esm/parse/securityRequirements.js +8 -0
  23. package/esm/parse/v3-0/_merge-all-of/merge-union.js +9 -1
  24. package/esm/parse/v3-0/mediaType/toMediaTypeItemV3.js +4 -3
  25. package/esm/parse/v3-0/parameter/toParameterV3.js +4 -3
  26. package/esm/parse/v3-0/ref/toRefV31.js +5 -2
  27. package/esm/parse/v3-0/schema/toSchemasV3.js +6 -3
  28. package/esm/parse/v3-1/_merge-all-of/merge-union.js +16 -4
  29. package/esm/parse/v3-1/mediaType/toMediaTypeItemV3.js +4 -3
  30. package/esm/parse/v3-1/parameter/toParameterV3.js +4 -3
  31. package/esm/parse/v3-1/ref/toRefV31.js +5 -2
  32. package/esm/parse/v3-1/schema/toSchemasV3.js +6 -3
  33. package/esm/parse/v3-2/_merge-all-of/merge-union.js +16 -4
  34. package/esm/parse/v3-2/mediaType/toMediaTypeItemV3.js +4 -3
  35. package/esm/parse/v3-2/parameter/toParameterV3.js +4 -3
  36. package/esm/parse/v3-2/ref/toRefV31.js +5 -2
  37. package/esm/parse/v3-2/schema/toSchemasV3.js +6 -3
  38. package/esm/types/Settings.d.ts +21 -0
  39. package/esm/types/Settings.js +19 -1
  40. package/package.json +5 -1
  41. package/script/context/GenerateContext.d.ts +1 -1
  42. package/script/context/GenerateContext.js +4 -3
  43. package/script/context/ParseContext.d.ts +26 -0
  44. package/script/context/ParseContext.js +112 -2
  45. package/script/context/generateTypes.d.ts +16 -2
  46. package/script/context/generateTypes.js +2 -0
  47. package/script/context/tryParseAt.d.ts +4 -1
  48. package/script/context/tryParseAt.js +10 -3
  49. package/script/helpers/collateExamples.js +15 -5
  50. package/script/helpers/refFns.d.ts +9 -3
  51. package/script/helpers/refFns.js +29 -9
  52. package/script/mod.d.ts +1 -0
  53. package/script/mod.js +1 -0
  54. package/script/oas/ref/DanglingRefError.d.ts +22 -0
  55. package/script/oas/ref/DanglingRefError.js +37 -0
  56. package/script/oas/ref/Ref.d.ts +5 -0
  57. package/script/oas/ref/Ref.js +28 -2
  58. package/script/oas/schema/siblings.js +12 -2
  59. package/script/oas/union/Union.d.ts +2 -1
  60. package/script/oas/union/Union.js +23 -12
  61. package/script/parse/securityRequirements.d.ts +6 -0
  62. package/script/parse/securityRequirements.js +8 -0
  63. package/script/parse/v3-0/_merge-all-of/merge-union.js +9 -1
  64. package/script/parse/v3-0/mediaType/toMediaTypeItemV3.js +4 -3
  65. package/script/parse/v3-0/parameter/toParameterV3.js +4 -3
  66. package/script/parse/v3-0/ref/toRefV31.js +5 -2
  67. package/script/parse/v3-0/schema/toSchemasV3.js +6 -3
  68. package/script/parse/v3-1/_merge-all-of/merge-union.js +16 -4
  69. package/script/parse/v3-1/mediaType/toMediaTypeItemV3.js +4 -3
  70. package/script/parse/v3-1/parameter/toParameterV3.js +4 -3
  71. package/script/parse/v3-1/ref/toRefV31.js +5 -2
  72. package/script/parse/v3-1/schema/toSchemasV3.js +6 -3
  73. package/script/parse/v3-2/_merge-all-of/merge-union.js +16 -4
  74. package/script/parse/v3-2/mediaType/toMediaTypeItemV3.js +4 -3
  75. package/script/parse/v3-2/parameter/toParameterV3.js +4 -3
  76. package/script/parse/v3-2/ref/toRefV31.js +5 -2
  77. package/script/parse/v3-2/schema/toSchemasV3.js +6 -3
  78. package/script/types/Settings.d.ts +21 -0
  79. package/script/types/Settings.js +20 -2
@@ -162,6 +162,15 @@ export declare const includeModels: v.GenericSchema<IncludeModels>;
162
162
  * {@link AnchorsSettings} for the consumer-facing fields.
163
163
  */
164
164
  export declare const anchorsSettings: v.GenericSchema<AnchorsSettings>;
165
+ /**
166
+ * What `client.json#settings.system.danglingRefs` can list: each kind of
167
+ * `$ref`, and `allOfMember`, a `$ref` that core merges at parse: a member of
168
+ * an `allOf`, also one inside a `oneOf` or `anyOf` member, or a `oneOf` or
169
+ * `anyOf` member merged with the keywords beside the union.
170
+ */
171
+ export declare const danglingRefKinds: readonly ["schema", "parameter", "requestBody", "response", "header", "securityScheme", "example", "link", "allOfMember"];
172
+ /** A kind of `$ref` that `system.danglingRefs` can let name nothing. */
173
+ export type DanglingRefKind = (typeof danglingRefKinds)[number];
165
174
  /** Valibot schema for {@link SystemSettings}: `client.json#settings.system`. */
166
175
  export declare const systemSettings: v.GenericSchema<SystemSettings>;
167
176
  export declare const clientSettings: v.GenericSchema<ClientSettings>;
@@ -449,6 +458,18 @@ export type SystemSettings = {
449
458
  * keywords and without the `anyOf`, with one warning for each schema.
450
459
  */
451
460
  anyOf?: 'union' | 'unknown';
461
+ /**
462
+ * The kinds of `$ref` that may name nothing in the document. A dangling
463
+ * `$ref` of a listed kind stays, with a warning, and resolving it throws
464
+ * `DanglingRefError` for the generator to handle. A dangling `$ref` of any
465
+ * other kind is a parse error, and what holds it is removed, with what uses
466
+ * that. `allOfMember` is core's own choice, made at parse: a `$ref` that
467
+ * core merges (a member of an `allOf`, also inside a `oneOf` or `anyOf`
468
+ * member, or a union member merged with the keywords beside the union) is
469
+ * left out of the merge, so its properties are not in the model. The
470
+ * default, `[]`, lists none.
471
+ */
472
+ danglingRefs?: DanglingRefKind[];
452
473
  };
453
474
  export type ClientSettings = {
454
475
  /** Base output path for generated files */
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.skmtcClientConfig = exports.clientSettings = exports.systemSettings = exports.anchorsSettings = exports.includeModels = exports.includeModelRefs = exports.includeOperations = exports.includePaths = exports.skipModels = exports.skipModelRefs = exports.skipOperations = exports.skipPaths = exports.modulePackages = exports.modulePackage = void 0;
36
+ exports.skmtcClientConfig = exports.clientSettings = exports.systemSettings = exports.danglingRefKinds = exports.anchorsSettings = exports.includeModels = exports.includeModelRefs = exports.includeOperations = exports.includePaths = exports.skipModels = exports.skipModelRefs = exports.skipOperations = exports.skipPaths = exports.modulePackages = exports.modulePackage = void 0;
37
37
  /**
38
38
  * @fileoverview SKMTC Core Settings and Configuration
39
39
  *
@@ -205,12 +205,30 @@ exports.anchorsSettings = v.object({
205
205
  enabled: v.boolean(),
206
206
  out: v.optional(v.string())
207
207
  });
208
+ /**
209
+ * What `client.json#settings.system.danglingRefs` can list: each kind of
210
+ * `$ref`, and `allOfMember`, a `$ref` that core merges at parse: a member of
211
+ * an `allOf`, also one inside a `oneOf` or `anyOf` member, or a `oneOf` or
212
+ * `anyOf` member merged with the keywords beside the union.
213
+ */
214
+ exports.danglingRefKinds = [
215
+ 'schema',
216
+ 'parameter',
217
+ 'requestBody',
218
+ 'response',
219
+ 'header',
220
+ 'securityScheme',
221
+ 'example',
222
+ 'link',
223
+ 'allOfMember'
224
+ ];
208
225
  /** Valibot schema for {@link SystemSettings}: `client.json#settings.system`. */
209
226
  exports.systemSettings = v.object({
210
227
  allOf: v.optional(v.picklist(['strict', 'latestWins'])),
211
228
  responseContradictions: v.optional(v.picklist(['strict', 'unknown'])),
212
229
  not: v.optional(v.picklist(['strict', 'unknown'])),
213
- anyOf: v.optional(v.picklist(['union', 'unknown']))
230
+ anyOf: v.optional(v.picklist(['union', 'unknown'])),
231
+ danglingRefs: v.optional(v.array(v.picklist(exports.danglingRefKinds)))
214
232
  });
215
233
  exports.clientSettings = v.object({
216
234
  basePath: v.optional(v.pipe(v.string(), v.check(basePath => !(0, normalizeWorkspacePath_js_1.isAbsolutePath)(basePath), 'basePath must be relative to the SKMTC root (the directory containing .skmtc/); ' +