@kubb/adapter-oas 5.0.0-beta.38 → 5.0.0-beta.39

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.
package/dist/index.cjs CHANGED
@@ -640,8 +640,8 @@ async function mergeDocuments(pathOrApi) {
640
640
  enablePaths: false,
641
641
  canBundle: false
642
642
  })));
643
- if (documents.length === 0) throw new _kubb_core.DiagnosticError({
644
- code: _kubb_core.diagnosticCode.inputRequired,
643
+ if (documents.length === 0) throw new _kubb_core.Diagnostics.Error({
644
+ code: _kubb_core.Diagnostics.code.inputRequired,
645
645
  severity: "error",
646
646
  message: "No OAS documents were provided for merging.",
647
647
  help: "Pass at least one path or document to `input.path`.",
@@ -690,8 +690,8 @@ async function parseFromConfig(source) {
690
690
  */
691
691
  async function assertInputExists(input) {
692
692
  if (new URLPath(input).isURL) return;
693
- if (!await exists(input)) throw new _kubb_core.DiagnosticError({
694
- code: _kubb_core.diagnosticCode.inputNotFound,
693
+ if (!await exists(input)) throw new _kubb_core.Diagnostics.Error({
694
+ code: _kubb_core.Diagnostics.code.inputNotFound,
695
695
  severity: "error",
696
696
  message: `Cannot read the file set in \`input.path\` (or via \`kubb generate PATH\`): ${input}`,
697
697
  help: "Check that the path exists and is readable, then set it in `input.path` or pass it as `kubb generate PATH`.",
@@ -745,7 +745,7 @@ function resolveRef(document, $ref) {
745
745
  const current = $ref.split("/").filter(Boolean).reduce((obj, key) => obj?.[key], document);
746
746
  if (!current) {
747
747
  const diagnostic = {
748
- code: _kubb_core.diagnosticCode.refNotFound,
748
+ code: _kubb_core.Diagnostics.code.refNotFound,
749
749
  severity: "error",
750
750
  message: `Could not find a definition for ${origRef}.`,
751
751
  help: "Add the schema under `components.schemas`, or fix the `$ref`. Run `kubb validate` to check the spec.",
@@ -755,7 +755,7 @@ function resolveRef(document, $ref) {
755
755
  ref: origRef
756
756
  }
757
757
  };
758
- if (!_kubb_core.Diagnostics.report(diagnostic)) throw new _kubb_core.DiagnosticError(diagnostic);
758
+ if (!_kubb_core.Diagnostics.report(diagnostic)) throw new _kubb_core.Diagnostics.Error(diagnostic);
759
759
  return null;
760
760
  }
761
761
  docCache.set($ref, current);
@@ -832,8 +832,8 @@ function resolveServerUrl(server, overrides) {
832
832
  for (const [key, variable] of Object.entries(server.variables)) {
833
833
  const value = overrides?.[key] ?? (variable.default != null ? String(variable.default) : void 0);
834
834
  if (value === void 0) continue;
835
- if (variable.enum?.length && !variable.enum.some((e) => String(e) === value)) throw new _kubb_core.DiagnosticError({
836
- code: _kubb_core.diagnosticCode.invalidServerVariable,
835
+ if (variable.enum?.length && !variable.enum.some((e) => String(e) === value)) throw new _kubb_core.Diagnostics.Error({
836
+ code: _kubb_core.Diagnostics.code.invalidServerVariable,
837
837
  severity: "error",
838
838
  message: `Invalid server variable value '${value}' for '${key}' when resolving ${server.url}. Valid values are: ${variable.enum.join(", ")}.`,
839
839
  help: `Use one of the allowed enum values, or drop the enum on the '${key}' server variable.`,
@@ -2175,7 +2175,7 @@ function escapePointerToken(token) {
2175
2175
  }
2176
2176
  function visit(node, pointer) {
2177
2177
  if (node.deprecated) _kubb_core.Diagnostics.report({
2178
- code: _kubb_core.diagnosticCode.deprecated,
2178
+ code: _kubb_core.Diagnostics.code.deprecated,
2179
2179
  severity: "info",
2180
2180
  message: "This schema is marked as deprecated.",
2181
2181
  location: {
@@ -2184,7 +2184,7 @@ function visit(node, pointer) {
2184
2184
  }
2185
2185
  });
2186
2186
  if (typeof node.format === "string" && !isHandledFormat(node.format)) _kubb_core.Diagnostics.report({
2187
- code: _kubb_core.diagnosticCode.unsupportedFormat,
2187
+ code: _kubb_core.Diagnostics.code.unsupportedFormat,
2188
2188
  severity: "warning",
2189
2189
  message: `Kubb does not map the format "${node.format}" to a specific type, so it falls back to the base type.`,
2190
2190
  help: `Use a format Kubb supports, or handle "${node.format}" with a custom parser or plugin.`,