@kmudrick/io-ts-openapi
Advanced tools
Comparing version 0.0.15 to 0.0.16
@@ -35,3 +35,7 @@ "use strict"; | ||
else { | ||
return t.typeCombinator(Object.keys(properties).map((key) => t.property(key, toTypeReference(properties[key]), schema.required?.includes(key) ?? false))); | ||
return t.typeCombinator(Object.keys(properties).map((key) => { | ||
const isOptional = !(schema.required?.includes(key) ?? false); | ||
const type = toTypeReference(properties[key]); | ||
return t.property(key, type, isOptional); | ||
})); | ||
} | ||
@@ -73,2 +77,3 @@ } | ||
const isExported = true; | ||
const isReadonly = true; | ||
function toDeclarations(references) { | ||
@@ -83,3 +88,3 @@ const start = []; | ||
} | ||
const declaration = t.typeDeclaration(name, typeReference, isExported); | ||
const declaration = t.typeDeclaration(name, typeReference, isExported, isReadonly); | ||
return [...acc, declaration]; | ||
@@ -86,0 +91,0 @@ }, start); |
{ | ||
"name": "@kmudrick/io-ts-openapi", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"license": "MIT", | ||
@@ -49,2 +49,3 @@ "repository": { | ||
"@apidevtools/json-schema-ref-parser": "^9.0.9", | ||
"assert": "^2.0.0", | ||
"fp-ts": "^2.11.10", | ||
@@ -51,0 +52,0 @@ "io-ts": "^2.2.16", |
@@ -20,9 +20,7 @@ import * as t from "io-ts-codegen"; | ||
return t.typeCombinator( | ||
Object.keys(properties).map((key) => | ||
t.property( | ||
key, | ||
toTypeReference(properties[key]), | ||
schema.required?.includes(key) ?? false | ||
) | ||
) | ||
Object.keys(properties).map((key) => { | ||
const isOptional = !(schema.required?.includes(key) ?? false); | ||
const type = toTypeReference(properties[key]); | ||
return t.property(key, type, isOptional); | ||
}) | ||
); | ||
@@ -69,2 +67,3 @@ } | ||
const isExported = true; | ||
const isReadonly = true; | ||
@@ -89,3 +88,8 @@ export function toDeclarations( | ||
} | ||
const declaration = t.typeDeclaration(name, typeReference, isExported); | ||
const declaration = t.typeDeclaration( | ||
name, | ||
typeReference, | ||
isExported, | ||
isReadonly | ||
); | ||
return [...acc, declaration]; | ||
@@ -92,0 +96,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43073
767
9
+ Addedassert@^2.0.0
+ Addedassert@2.1.0(transitive)
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedcall-bind@1.0.8(transitive)
+ Addedcall-bind-apply-helpers@1.0.1(transitive)
+ Addedcall-bound@1.0.3(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addeddunder-proto@1.0.1(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.0.0(transitive)
+ Addedfor-each@0.3.3(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.7(transitive)
+ Addedget-proto@1.0.1(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-arguments@1.2.0(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-generator-function@1.1.0(transitive)
+ Addedis-nan@1.3.2(transitive)
+ Addedis-regex@1.2.1(transitive)
+ Addedis-typed-array@1.1.15(transitive)
+ Addedmath-intrinsics@1.1.0(transitive)
+ Addedobject-is@1.1.6(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.7(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedsafe-regex-test@1.1.0(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedutil@0.12.5(transitive)
+ Addedwhich-typed-array@1.1.18(transitive)