@kubb/oas 4.15.0 → 4.15.2
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 +14 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +1 -0
- package/src/utils.ts +29 -0
package/dist/index.cjs
CHANGED
|
@@ -4173,6 +4173,19 @@ function isRequired(schema) {
|
|
|
4173
4173
|
if (!schema) return false;
|
|
4174
4174
|
return Array.isArray(schema.required) ? !!schema.required?.length : !!schema.required;
|
|
4175
4175
|
}
|
|
4176
|
+
function isAllOptional(schema) {
|
|
4177
|
+
if (!schema) return true;
|
|
4178
|
+
if (isOptional(schema)) return true;
|
|
4179
|
+
const s = schema;
|
|
4180
|
+
if (Array.isArray(s?.required) && s?.required.length > 0) return false;
|
|
4181
|
+
const groups = [
|
|
4182
|
+
s?.allOf,
|
|
4183
|
+
s?.anyOf,
|
|
4184
|
+
s?.oneOf
|
|
4185
|
+
].filter((g) => Array.isArray(g));
|
|
4186
|
+
if (groups.length === 0) return true;
|
|
4187
|
+
return groups.every((arr) => arr.every((child) => isAllOptional(child)));
|
|
4188
|
+
}
|
|
4176
4189
|
function isOptional(schema) {
|
|
4177
4190
|
return !isRequired(schema);
|
|
4178
4191
|
}
|
|
@@ -4519,6 +4532,7 @@ Object.defineProperty(exports, 'findSchemaDefinition', {
|
|
|
4519
4532
|
return oas_utils.findSchemaDefinition;
|
|
4520
4533
|
}
|
|
4521
4534
|
});
|
|
4535
|
+
exports.isAllOptional = isAllOptional;
|
|
4522
4536
|
exports.isDiscriminator = isDiscriminator;
|
|
4523
4537
|
exports.isNullable = isNullable;
|
|
4524
4538
|
exports.isOpenApiV3_1Document = isOpenApiV3_1Document;
|