@kubb/plugin-oas 3.10.1 → 3.10.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.
Files changed (56) hide show
  1. package/dist/{OperationGenerator-DiF6WJNP.d.cts → OperationGenerator-BrnQyed_.d.cts} +9 -1
  2. package/dist/{OperationGenerator-DiF6WJNP.d.ts → OperationGenerator-BrnQyed_.d.ts} +9 -1
  3. package/dist/Schema-DTc2F3jG.d.cts +32 -0
  4. package/dist/Schema-Dhz38Get.d.ts +32 -0
  5. package/dist/{chunk-72MVTXCW.js → chunk-5JWN6NVC.js} +245 -133
  6. package/dist/chunk-5JWN6NVC.js.map +1 -0
  7. package/dist/{chunk-DUZZHEQI.cjs → chunk-ES7R7N34.cjs} +6 -6
  8. package/dist/chunk-ES7R7N34.cjs.map +1 -0
  9. package/dist/{chunk-BAU7PO7T.js → chunk-JNN4JPWK.js} +4 -4
  10. package/dist/chunk-JNN4JPWK.js.map +1 -0
  11. package/dist/{chunk-3Y4QGY6D.js → chunk-PORSNYI5.js} +3 -3
  12. package/dist/chunk-PORSNYI5.js.map +1 -0
  13. package/dist/{chunk-Q4HTTWL7.cjs → chunk-PSWNN6SJ.cjs} +245 -133
  14. package/dist/chunk-PSWNN6SJ.cjs.map +1 -0
  15. package/dist/{chunk-DN373TFU.js → chunk-RNF2QJEG.js} +4 -4
  16. package/dist/chunk-RNF2QJEG.js.map +1 -0
  17. package/dist/{chunk-KXB5DUFD.cjs → chunk-Z2NREI4X.cjs} +4 -4
  18. package/dist/chunk-Z2NREI4X.cjs.map +1 -0
  19. package/dist/{chunk-B7KP5ZFA.cjs → chunk-ZVFL3NXX.cjs} +3 -3
  20. package/dist/chunk-ZVFL3NXX.cjs.map +1 -0
  21. package/dist/components.cjs +4 -4
  22. package/dist/components.d.cts +2 -2
  23. package/dist/components.d.ts +2 -2
  24. package/dist/components.js +1 -1
  25. package/dist/generators.cjs +4 -4
  26. package/dist/generators.d.cts +1 -1
  27. package/dist/generators.d.ts +1 -1
  28. package/dist/generators.js +3 -3
  29. package/dist/hooks.cjs +9 -9
  30. package/dist/hooks.d.cts +2 -2
  31. package/dist/hooks.d.ts +2 -2
  32. package/dist/hooks.js +3 -3
  33. package/dist/index.cjs +11 -11
  34. package/dist/index.d.cts +2 -2
  35. package/dist/index.d.ts +2 -2
  36. package/dist/index.js +6 -6
  37. package/dist/utils.cjs +3 -3
  38. package/dist/utils.d.cts +10 -3
  39. package/dist/utils.d.ts +10 -3
  40. package/dist/utils.js +1 -1
  41. package/package.json +7 -7
  42. package/src/SchemaGenerator.ts +271 -132
  43. package/src/SchemaMapper.ts +1 -0
  44. package/src/components/Schema.tsx +13 -4
  45. package/src/generator.tsx +8 -1
  46. package/src/utils/getSchemaFactory.ts +10 -3
  47. package/dist/Schema-BbIxCfn7.d.ts +0 -23
  48. package/dist/Schema-Ds5f4y7m.d.cts +0 -23
  49. package/dist/chunk-3Y4QGY6D.js.map +0 -1
  50. package/dist/chunk-72MVTXCW.js.map +0 -1
  51. package/dist/chunk-B7KP5ZFA.cjs.map +0 -1
  52. package/dist/chunk-BAU7PO7T.js.map +0 -1
  53. package/dist/chunk-DN373TFU.js.map +0 -1
  54. package/dist/chunk-DUZZHEQI.cjs.map +0 -1
  55. package/dist/chunk-KXB5DUFD.cjs.map +0 -1
  56. package/dist/chunk-Q4HTTWL7.cjs.map +0 -1
@@ -110,6 +110,7 @@ type SchemaKeywordMapper = {
110
110
  keyword: 'ref';
111
111
  args: {
112
112
  name: string;
113
+ $ref: string;
113
114
  /**
114
115
  * Full qualified path.
115
116
  */
@@ -454,7 +455,7 @@ type SchemaGeneratorOptions = {
454
455
  };
455
456
  type SchemaGeneratorBuildOptions = Omit<OperationSchema, 'name' | 'schema'>;
456
457
  type SchemaProps$1 = {
457
- schema?: SchemaObject;
458
+ schemaObject?: SchemaObject;
458
459
  name?: string;
459
460
  parentName?: string;
460
461
  };
@@ -513,6 +514,13 @@ type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {
513
514
  Operation?: (this: ReactGeneratorOptions<TOptions>, props: OperationProps<TOptions>) => KubbNode;
514
515
  Schema?: (this: ReactGeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => KubbNode;
515
516
  };
517
+ /****
518
+ * Creates a generator that uses React component functions to generate files for OpenAPI operations and schemas.
519
+ *
520
+ * The returned generator exposes async methods for generating files from operations, a single operation, or a schema, using the corresponding React components if provided. If a component is not defined, the method returns an empty array.
521
+ *
522
+ * @returns A generator object with async methods for operations, operation, and schema file generation.
523
+ */
516
524
  declare function createReactGenerator<TOptions extends PluginFactoryOptions>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions>;
517
525
 
518
526
  type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
@@ -110,6 +110,7 @@ type SchemaKeywordMapper = {
110
110
  keyword: 'ref';
111
111
  args: {
112
112
  name: string;
113
+ $ref: string;
113
114
  /**
114
115
  * Full qualified path.
115
116
  */
@@ -454,7 +455,7 @@ type SchemaGeneratorOptions = {
454
455
  };
455
456
  type SchemaGeneratorBuildOptions = Omit<OperationSchema, 'name' | 'schema'>;
456
457
  type SchemaProps$1 = {
457
- schema?: SchemaObject;
458
+ schemaObject?: SchemaObject;
458
459
  name?: string;
459
460
  parentName?: string;
460
461
  };
@@ -513,6 +514,13 @@ type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {
513
514
  Operation?: (this: ReactGeneratorOptions<TOptions>, props: OperationProps<TOptions>) => KubbNode;
514
515
  Schema?: (this: ReactGeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => KubbNode;
515
516
  };
517
+ /****
518
+ * Creates a generator that uses React component functions to generate files for OpenAPI operations and schemas.
519
+ *
520
+ * The returned generator exposes async methods for generating files from operations, a single operation, or a schema, using the corresponding React components if provided. If a component is not defined, the method returns an empty array.
521
+ *
522
+ * @returns A generator object with async methods for operations, operation, and schema file generation.
523
+ */
516
524
  declare function createReactGenerator<TOptions extends PluginFactoryOptions>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions>;
517
525
 
518
526
  type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>;
@@ -0,0 +1,32 @@
1
+ import * as react from 'react';
2
+ import { SchemaObject } from '@kubb/oas';
3
+ import { Key, KubbNode } from '@kubb/react/types';
4
+ import { f as Schema$1 } from './OperationGenerator-BrnQyed_.cjs';
5
+
6
+ type SchemaContextProps = {
7
+ name: string;
8
+ schemaObject?: SchemaObject;
9
+ tree: Array<Schema$1>;
10
+ };
11
+ type Props = {
12
+ key?: Key;
13
+ name: string;
14
+ schemaObject?: SchemaObject;
15
+ tree?: Array<Schema$1>;
16
+ children?: KubbNode;
17
+ };
18
+ /**
19
+ * Provides schema-related context to descendant components.
20
+ *
21
+ * Wraps its children with a context containing the schema name, optional schema object, and an optional schema type tree.
22
+ *
23
+ * @param name - The name of the schema.
24
+ * @param schemaObject - The schema object to provide in context, if available.
25
+ * @param tree - An array representing the schema type hierarchy.
26
+ */
27
+ declare function Schema({ name, schemaObject, tree, children }: Props): any;
28
+ declare namespace Schema {
29
+ var Context: react.Context<SchemaContextProps>;
30
+ }
31
+
32
+ export { Schema as S, type SchemaContextProps as a };
@@ -0,0 +1,32 @@
1
+ import * as react from 'react';
2
+ import { SchemaObject } from '@kubb/oas';
3
+ import { Key, KubbNode } from '@kubb/react/types';
4
+ import { f as Schema$1 } from './OperationGenerator-BrnQyed_.js';
5
+
6
+ type SchemaContextProps = {
7
+ name: string;
8
+ schemaObject?: SchemaObject;
9
+ tree: Array<Schema$1>;
10
+ };
11
+ type Props = {
12
+ key?: Key;
13
+ name: string;
14
+ schemaObject?: SchemaObject;
15
+ tree?: Array<Schema$1>;
16
+ children?: KubbNode;
17
+ };
18
+ /**
19
+ * Provides schema-related context to descendant components.
20
+ *
21
+ * Wraps its children with a context containing the schema name, optional schema object, and an optional schema type tree.
22
+ *
23
+ * @param name - The name of the schema.
24
+ * @param schemaObject - The schema object to provide in context, if available.
25
+ * @param tree - An array representing the schema type hierarchy.
26
+ */
27
+ declare function Schema({ name, schemaObject, tree, children }: Props): any;
28
+ declare namespace Schema {
29
+ var Context: react.Context<SchemaContextProps>;
30
+ }
31
+
32
+ export { Schema as S, type SchemaContextProps as a };