@kubb/plugin-zod 3.0.0-alpha.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.
- package/LICENSE +21 -0
- package/README.md +44 -0
- package/dist/Operations-BlQtRP31.d.cts +47 -0
- package/dist/Operations-BlQtRP31.d.ts +47 -0
- package/dist/chunk-7IAXQL4T.cjs +1291 -0
- package/dist/chunk-7IAXQL4T.cjs.map +1 -0
- package/dist/chunk-OXCOZC6T.js +1291 -0
- package/dist/chunk-OXCOZC6T.js.map +1 -0
- package/dist/components.cjs +11 -0
- package/dist/components.cjs.map +1 -0
- package/dist/components.d.cts +28 -0
- package/dist/components.d.ts +28 -0
- package/dist/components.js +11 -0
- package/dist/components.js.map +1 -0
- package/dist/index.cjs +16 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +156 -0
- package/dist/index.d.ts +156 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/package.json +97 -0
- package/src/OperationGenerator.tsx +54 -0
- package/src/SchemaGenerator.tsx +31 -0
- package/src/components/OperationSchema.tsx +66 -0
- package/src/components/Operations.tsx +133 -0
- package/src/components/Schema.tsx +171 -0
- package/src/components/__snapshots__/operations.ts +50 -0
- package/src/components/index.ts +3 -0
- package/src/index.ts +15 -0
- package/src/parser/index.ts +345 -0
- package/src/plugin.ts +167 -0
- package/src/types.ts +151 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Stijn Van Hulle
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<!-- <img src="assets/logo.png" alt="logo" width="200" height="auto" /> -->
|
|
4
|
+
<h1>@kubb/plugin-zod</h1>
|
|
5
|
+
|
|
6
|
+
<p>
|
|
7
|
+
Swagger integration for Zod to generate all the different schemas based on an OpenAPI specification.
|
|
8
|
+
</p>
|
|
9
|
+
<img src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/banner.png" alt="logo" height="auto" />
|
|
10
|
+
|
|
11
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
12
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
13
|
+
[![Coverage][coverage-src]][coverage-href]
|
|
14
|
+
[![License][license-src]][license-href]
|
|
15
|
+
|
|
16
|
+
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
17
|
+
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
<h4>
|
|
21
|
+
<a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/alpha/examples/typescript" target="_blank">View Demo</a>
|
|
22
|
+
<span> · </span>
|
|
23
|
+
<a href="https://kubb.dev/" target="_blank">Documentation</a>
|
|
24
|
+
<span> · </span>
|
|
25
|
+
<a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
|
|
26
|
+
<span> · </span>
|
|
27
|
+
<a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Request Feature</a>
|
|
28
|
+
</h4>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<!-- Badges -->
|
|
32
|
+
|
|
33
|
+
[npm-version-src]: https://img.shields.io/npm/v/@kubb/plugin-zod?flat&colorA=18181B&colorB=f58517
|
|
34
|
+
[npm-version-href]: https://npmjs.com/package/@kubb/plugin-zod
|
|
35
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/@kubb/plugin-zod?flat&colorA=18181B&colorB=f58517
|
|
36
|
+
[npm-downloads-href]: https://npmjs.com/package/@kubb/plugin-zod
|
|
37
|
+
[license-src]: https://img.shields.io/github/license/kubb-labs/kubb.svg?flat&colorA=18181B&colorB=f58517
|
|
38
|
+
[license-href]: https://github.com/kubb-labs/kubb/blob/main/LICENSE
|
|
39
|
+
[build-src]: https://img.shields.io/github/actions/workflow/status/kubb-labs/kubb/ci.yaml?style=flat&colorA=18181B&colorB=f58517
|
|
40
|
+
[build-href]: https://www.npmjs.com/package/@kubb/plugin-zod
|
|
41
|
+
[minified-src]: https://img.shields.io/bundlephobia/min/@kubb/plugin-zod?style=flat&colorA=18181B&colorB=f58517
|
|
42
|
+
[minified-href]: https://www.npmjs.com/package/@kubb/plugin-zod
|
|
43
|
+
[coverage-src]: https://img.shields.io/codecov/c/github/kubb-labs/kubb?style=flat&colorA=18181B&colorB=f58517
|
|
44
|
+
[coverage-href]: https://www.npmjs.com/package/@kubb/plugin-zod
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Operation } from '@kubb/oas';
|
|
2
|
+
import { KubbNode } from '@kubb/react';
|
|
3
|
+
import { ComponentType, ComponentProps } from 'react';
|
|
4
|
+
|
|
5
|
+
type TemplateProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Name of the function
|
|
8
|
+
*/
|
|
9
|
+
operationsName: string;
|
|
10
|
+
/**
|
|
11
|
+
* Name of the function
|
|
12
|
+
*/
|
|
13
|
+
pathsName: string;
|
|
14
|
+
operations: Operation[];
|
|
15
|
+
};
|
|
16
|
+
declare function Template({ operationsName, pathsName, operations }: TemplateProps): KubbNode;
|
|
17
|
+
type RootTemplateProps = {
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
};
|
|
20
|
+
declare function RootTemplate({ children }: RootTemplateProps): JSX.Element;
|
|
21
|
+
declare const defaultTemplates: {
|
|
22
|
+
readonly default: typeof Template;
|
|
23
|
+
readonly root: typeof RootTemplate;
|
|
24
|
+
};
|
|
25
|
+
type Templates = Partial<typeof defaultTemplates>;
|
|
26
|
+
type Props = {
|
|
27
|
+
/**
|
|
28
|
+
* This will make it possible to override the default behaviour.
|
|
29
|
+
*/
|
|
30
|
+
Template?: ComponentType<ComponentProps<typeof Template>>;
|
|
31
|
+
};
|
|
32
|
+
declare function Operations({ Template }: Props): KubbNode;
|
|
33
|
+
declare namespace Operations {
|
|
34
|
+
var File: (props: FileProps) => KubbNode;
|
|
35
|
+
var templates: {
|
|
36
|
+
readonly default: typeof Template;
|
|
37
|
+
readonly root: typeof RootTemplate;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
type FileProps = {
|
|
41
|
+
/**
|
|
42
|
+
* This will make it possible to override the default behaviour.
|
|
43
|
+
*/
|
|
44
|
+
templates?: Templates;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { Operations as O };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Operation } from '@kubb/oas';
|
|
2
|
+
import { KubbNode } from '@kubb/react';
|
|
3
|
+
import { ComponentType, ComponentProps } from 'react';
|
|
4
|
+
|
|
5
|
+
type TemplateProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Name of the function
|
|
8
|
+
*/
|
|
9
|
+
operationsName: string;
|
|
10
|
+
/**
|
|
11
|
+
* Name of the function
|
|
12
|
+
*/
|
|
13
|
+
pathsName: string;
|
|
14
|
+
operations: Operation[];
|
|
15
|
+
};
|
|
16
|
+
declare function Template({ operationsName, pathsName, operations }: TemplateProps): KubbNode;
|
|
17
|
+
type RootTemplateProps = {
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
};
|
|
20
|
+
declare function RootTemplate({ children }: RootTemplateProps): JSX.Element;
|
|
21
|
+
declare const defaultTemplates: {
|
|
22
|
+
readonly default: typeof Template;
|
|
23
|
+
readonly root: typeof RootTemplate;
|
|
24
|
+
};
|
|
25
|
+
type Templates = Partial<typeof defaultTemplates>;
|
|
26
|
+
type Props = {
|
|
27
|
+
/**
|
|
28
|
+
* This will make it possible to override the default behaviour.
|
|
29
|
+
*/
|
|
30
|
+
Template?: ComponentType<ComponentProps<typeof Template>>;
|
|
31
|
+
};
|
|
32
|
+
declare function Operations({ Template }: Props): KubbNode;
|
|
33
|
+
declare namespace Operations {
|
|
34
|
+
var File: (props: FileProps) => KubbNode;
|
|
35
|
+
var templates: {
|
|
36
|
+
readonly default: typeof Template;
|
|
37
|
+
readonly root: typeof RootTemplate;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
type FileProps = {
|
|
41
|
+
/**
|
|
42
|
+
* This will make it possible to override the default behaviour.
|
|
43
|
+
*/
|
|
44
|
+
templates?: Templates;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { Operations as O };
|