@standard-community/standard-openapi 0.2.5 → 0.2.7
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 +1 -0
- package/dist/index.js +1 -0
- package/dist/vendors/convert.cjs +5 -4
- package/dist/vendors/convert.js +5 -4
- package/dist/vendors/valibot.cjs +1 -0
- package/dist/vendors/valibot.js +1 -0
- package/package.json +6 -2
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
package/dist/vendors/convert.cjs
CHANGED
|
@@ -65,14 +65,15 @@ function convertToOpenAPISchema(jsonSchema, context) {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
|
-
if (_jsonSchema.ref) {
|
|
69
|
-
const { ref, ...component } = _jsonSchema;
|
|
68
|
+
if (_jsonSchema.ref || _jsonSchema.$id) {
|
|
69
|
+
const { ref, $id, ...component } = _jsonSchema;
|
|
70
|
+
const id = ref || $id;
|
|
70
71
|
context.components.schemas = {
|
|
71
72
|
...context.components.schemas,
|
|
72
|
-
[
|
|
73
|
+
[id]: component
|
|
73
74
|
};
|
|
74
75
|
return {
|
|
75
|
-
$ref: `#/components/schemas/${
|
|
76
|
+
$ref: `#/components/schemas/${id}`
|
|
76
77
|
};
|
|
77
78
|
} else if (_jsonSchema.$ref) {
|
|
78
79
|
const { $ref, $defs } = _jsonSchema;
|
package/dist/vendors/convert.js
CHANGED
|
@@ -63,14 +63,15 @@ function convertToOpenAPISchema(jsonSchema, context) {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
-
if (_jsonSchema.ref) {
|
|
67
|
-
const { ref, ...component } = _jsonSchema;
|
|
66
|
+
if (_jsonSchema.ref || _jsonSchema.$id) {
|
|
67
|
+
const { ref, $id, ...component } = _jsonSchema;
|
|
68
|
+
const id = ref || $id;
|
|
68
69
|
context.components.schemas = {
|
|
69
70
|
...context.components.schemas,
|
|
70
|
-
[
|
|
71
|
+
[id]: component
|
|
71
72
|
};
|
|
72
73
|
return {
|
|
73
|
-
$ref: `#/components/schemas/${
|
|
74
|
+
$ref: `#/components/schemas/${id}`
|
|
74
75
|
};
|
|
75
76
|
} else if (_jsonSchema.$ref) {
|
|
76
77
|
const { $ref, $defs } = _jsonSchema;
|
package/dist/vendors/valibot.cjs
CHANGED
|
@@ -6,6 +6,7 @@ var convert = require('./convert.cjs');
|
|
|
6
6
|
function getToOpenAPISchemaFn() {
|
|
7
7
|
return async (schema, context) => {
|
|
8
8
|
const openapiSchema = await standardJson.toJsonSchema(schema, {
|
|
9
|
+
errorMode: "ignore",
|
|
9
10
|
// @ts-expect-error
|
|
10
11
|
overrideAction: ({ valibotAction, jsonSchema }) => {
|
|
11
12
|
const _jsonSchema = convert.convertToOpenAPISchema(jsonSchema, context);
|
package/dist/vendors/valibot.js
CHANGED
|
@@ -4,6 +4,7 @@ import { convertToOpenAPISchema } from './convert.js';
|
|
|
4
4
|
function getToOpenAPISchemaFn() {
|
|
5
5
|
return async (schema, context) => {
|
|
6
6
|
const openapiSchema = await toJsonSchema(schema, {
|
|
7
|
+
errorMode: "ignore",
|
|
7
8
|
// @ts-expect-error
|
|
8
9
|
overrideAction: ({ valibotAction, jsonSchema }) => {
|
|
9
10
|
const _jsonSchema = convertToOpenAPISchema(jsonSchema, context);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@standard-community/standard-openapi",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -71,11 +71,12 @@
|
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"@standard-community/standard-json": "^0.3.
|
|
74
|
+
"@standard-community/standard-json": "^0.3.4",
|
|
75
75
|
"@standard-schema/spec": "^1.0.0",
|
|
76
76
|
"arktype": "^2.1.20",
|
|
77
77
|
"effect": "^3.17.14",
|
|
78
78
|
"openapi-types": "^12.1.3",
|
|
79
|
+
"typebox": "^1.0.0",
|
|
79
80
|
"valibot": "^1.1.0",
|
|
80
81
|
"zod": "^3.25.0 || ^4.0.0",
|
|
81
82
|
"zod-openapi": "^4"
|
|
@@ -87,6 +88,9 @@
|
|
|
87
88
|
"effect": {
|
|
88
89
|
"optional": true
|
|
89
90
|
},
|
|
91
|
+
"typebox": {
|
|
92
|
+
"optional": true
|
|
93
|
+
},
|
|
90
94
|
"valibot": {
|
|
91
95
|
"optional": true
|
|
92
96
|
},
|