@orval/core 8.5.1 → 8.5.3

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.d.mts CHANGED
@@ -8,7 +8,7 @@ import { TypeDocOptions } from "typedoc";
8
8
  //#region src/types.d.ts
9
9
  interface Options {
10
10
  output?: string | OutputOptions;
11
- input?: string | InputOptions;
11
+ input?: string | string[] | InputOptions;
12
12
  hooks?: Partial<HooksOptions>;
13
13
  }
14
14
  type OptionsFn = () => Options | Promise<Options>;
@@ -222,7 +222,7 @@ type InputFiltersOptions = {
222
222
  schemas?: (string | RegExp)[];
223
223
  };
224
224
  type InputOptions = {
225
- target: string | Record<string, unknown> | OpenApiDocument;
225
+ target: string | string[] | Record<string, unknown> | OpenApiDocument;
226
226
  override?: OverrideInput;
227
227
  filters?: InputFiltersOptions;
228
228
  parserOptions?: {
@@ -654,7 +654,7 @@ interface GlobalOptions {
654
654
  mode?: OutputMode;
655
655
  tsconfig?: string | Tsconfig;
656
656
  packageJson?: string;
657
- input?: string;
657
+ input?: string | string[];
658
658
  output?: string;
659
659
  verbose?: boolean;
660
660
  }
@@ -1031,10 +1031,7 @@ type GeneratorClientFooter = (data: {
1031
1031
  type GeneratorClientImports = (data: {
1032
1032
  client: OutputClient | OutputClientFunc;
1033
1033
  implementation: string;
1034
- imports: {
1035
- exports: GeneratorImport[];
1036
- dependency: string;
1037
- }[];
1034
+ imports: readonly GeneratorDependency[];
1038
1035
  projectName?: string;
1039
1036
  hasSchemaDir: boolean;
1040
1037
  isAllowSyntheticDefaultImports: boolean;
@@ -1046,10 +1043,7 @@ type GeneratorClientImports = (data: {
1046
1043
  }) => string;
1047
1044
  type GenerateMockImports = (data: {
1048
1045
  implementation: string;
1049
- imports: {
1050
- exports: GeneratorImport[];
1051
- dependency: string;
1052
- }[];
1046
+ imports: readonly GeneratorDependency[];
1053
1047
  projectName?: string;
1054
1048
  hasSchemaDir: boolean;
1055
1049
  isAllowSyntheticDefaultImports: boolean;
@@ -1676,13 +1670,24 @@ declare function resolveObject({
1676
1670
  }: ResolveOptions): ResolverValue;
1677
1671
  //#endregion
1678
1672
  //#region src/resolvers/ref.d.ts
1679
- declare function resolveRef<TSchema extends OpenApiComponentsObject = OpenApiComponentsObject>(schema: OpenApiComponentsObject, context: ContextSpec, imports?: GeneratorImport[]): {
1673
+ type Example = OpenApiExampleObject | OpenApiReferenceObject;
1674
+ type ResolvedExample = unknown;
1675
+ type Examples = Example[] | Record<string, Example> | ResolvedExample[] | Record<string, ResolvedExample> | undefined;
1676
+ /**
1677
+ * Recursively resolves a `$ref` in an OpenAPI document, following
1678
+ * nested schema refs and collecting imports along the way.
1679
+ *
1680
+ * Handles OpenAPI 3.0 `nullable` and 3.1 type-array hints on direct refs.
1681
+ *
1682
+ * @see https://spec.openapis.org/oas/v3.0.3#reference-object
1683
+ * @see https://spec.openapis.org/oas/v3.1.0#reference-object
1684
+ */
1685
+ declare function resolveRef<TSchema extends object = OpenApiComponentsObject>(schema: OpenApiComponentsObject | OpenApiReferenceObject, context: ContextSpec, imports?: GeneratorImport[]): {
1680
1686
  schema: TSchema;
1681
1687
  imports: GeneratorImport[];
1682
1688
  };
1683
- type Example = OpenApiExampleObject | OpenApiReferenceObject;
1684
- type Examples = Example[] | Record<string, Example> | undefined;
1685
- declare function resolveExampleRefs(examples: Examples, context: ContextSpec): Examples;
1689
+ /** Recursively resolves `$ref` entries in an examples array or record. */
1690
+ declare function resolveExampleRefs(examples: Examples, context: ContextSpec): ResolvedExample[] | Record<string, ResolvedExample> | undefined;
1686
1691
  //#endregion
1687
1692
  //#region src/resolvers/value.d.ts
1688
1693
  interface ResolveValueOptions {
@@ -1897,9 +1902,10 @@ declare function mergeDeep<T extends Record<string, unknown>, U extends Record<s
1897
1902
  //#region src/utils/occurrence.d.ts
1898
1903
  declare function count(str: string | undefined, key: string): number;
1899
1904
  declare namespace path_d_exports {
1900
- export { basename, dirname, extname, getSchemaFileName, isAbsolute, join, joinSafe, normalizeSafe, relativeSafe, resolve, separator$1 as separator };
1905
+ export { getRelativeImportPath, getSchemaFileName, join, joinSafe, normalizeSafe, relativeSafe, separator$1 as separator, toUnix };
1901
1906
  }
1902
- declare const join: (...paths: string[]) => string, resolve: (...paths: string[]) => string, extname: (path: string) => string, dirname: (path: string) => string, basename: (path: string, suffix?: string) => string, isAbsolute: (path: string) => boolean;
1907
+ declare function toUnix(value: string): string;
1908
+ declare function join(...args: string[]): string;
1903
1909
  /**
1904
1910
  * Behaves exactly like `path.relative(from, to)`, but keeps the first meaningful "./"
1905
1911
  */
@@ -1908,6 +1914,29 @@ declare function getSchemaFileName(path: string): string;
1908
1914
  declare const separator$1 = "/";
1909
1915
  declare function normalizeSafe(value: string): string;
1910
1916
  declare function joinSafe(...values: string[]): string;
1917
+ /**
1918
+ * Given two absolute file paths, generates a valid ESM relative import path
1919
+ * from the 'importer' file to the 'exporter' file.
1920
+ *
1921
+ * @example
1922
+ * ```ts
1923
+ * getRelativeImportPath('/path/to/importer.ts', '/path/to/exporter.ts')
1924
+ * // => './exporter'
1925
+ * getRelativeImportPath('/path/to/importer.ts', '/path/to/sub/exporter.ts')
1926
+ * // => './sub/exporter'
1927
+ * getRelativeImportPath('/path/to/importer.ts', '/path/sibling/exporter.ts')
1928
+ * // => '../sibling/exporter'
1929
+ * ```
1930
+ *
1931
+ * This function handles path normalization, cross-platform separators, and
1932
+ * ensures the path is a valid ESM relative specifier (e.g., starts with './').
1933
+ *
1934
+ * @param importerFilePath - The absolute path of the file that will contain the import statement.
1935
+ * @param exporterFilePath - The absolute path of the file being imported.
1936
+ * @param [includeFileExtension=false] - Whether the import path should include the file extension, defaults to false.
1937
+ * @returns The relative import path string.
1938
+ */
1939
+ declare function getRelativeImportPath(importerFilePath: string, exporterFilePath: string, includeFileExtension?: boolean): string;
1911
1940
  //#endregion
1912
1941
  //#region src/utils/resolve-version.d.ts
1913
1942
  declare function resolveInstalledVersion(packageName: string, fromDir: string): string | undefined;
@@ -1989,14 +2018,16 @@ declare function toObjectString<T>(props: T[], path?: keyof T): string;
1989
2018
  */
1990
2019
  declare function getNumberWord(num: number): string;
1991
2020
  /**
1992
- * Escapes a specific character in a string by prefixing it with a backslash.
2021
+ * Escapes a specific character in a string by prefixing all of its occurrences with a backslash.
1993
2022
  *
1994
2023
  * @param str - The string to escape, or null.
1995
2024
  * @param char - The character to escape. Defaults to single quote (').
1996
2025
  * @returns The escaped string, or null if the input is null.
1997
2026
  * @example
1998
2027
  * escape("don't") // returns "don\'t"
2028
+ * escape("it's John's") // returns "it\'s John\'s"
1999
2029
  * escape('say "hello"', '"') // returns 'say \\"hello\\"'
2030
+ * escape("a'''b", "'") // returns "a\'\'\'b"
2000
2031
  */
2001
2032
  declare function escape(str: string | null, char?: string): string | undefined;
2002
2033
  /**