Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const keepOptionals = (i: IExtendedObjectType): ITameExtendedObjectType =>
new Iso<
IExtendedObjectType,
Array<[string, ExtendedValueType | IMaybeJSONValue]>
>(
a => Object.entries(a),
q => q.reduce((a, b) => ({ ...a, [b[0]]: b[1] }), {}),
)
.composeTraversal(fromTraversable(array)())
.composePrism(
new Prism<
[string, ExtendedValueType | IMaybeJSONValue],
[string, ExtendedValueType]
>(a => (MaybeJSONValue.is(a[1]) ? some([a[0], a[1].val]) : none), a => a),
)
.composeGetter(identityGetter())
.getAll(i)
.reduce((a, b) => ({ ...a, [b[0]]: b[1] }), {});
(req: ISerializedRequest, r: Record): Record =>
objectToArray()
.composeTraversal(
fromTraversable(array)<[string, OpenAPIObject]>()
.filter(([__, o]) =>
matchUrls(req.protocol, req.host, o).length > 0))
.composeLens(valueLens()).modify(oai => f({
...req,
path: truncatePath(req.path, oai, req),
pathname: truncatePath(req.pathname, oai, req),
}, oai))(r);
const operationPathParameter = (
vname: string,
pathItem: PathItem,
operation: MethodNames,
oas: OpenAPIObject,
) =>
internalGetParameter(
Optional.fromNullableProp()(operation)
.composeOptional(Optional.fromNullableProp()("parameters"))
.composeTraversal(fromTraversable(array)()),
vname,
pathItem,
oas,
);