mirror of
https://github.com/jellyfin/jellyfin-sdk-typescript.git
synced 2024-11-22 21:49:48 +00:00
Fix modify-schema crash on null allOf value
This commit is contained in:
parent
20c0699a5a
commit
a40903984f
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* This script works around an issue with the openapi generator
|
||||
* not parsing allOf types correctly.
|
||||
*
|
||||
*
|
||||
* Originally part of the jellyfin-client-axios project:
|
||||
* https://github.com/jellyfin/jellyfin-client-axios/blob/dfadff9b0b8749a04fb21d298b86624b20db1e5a/scripts/modifySchema.mjs
|
||||
*/
|
||||
@ -11,10 +11,10 @@ import fs from 'fs/promises';
|
||||
let txt = await fs.readFile(file);
|
||||
const json = JSON.parse(txt, (_, value) => {
|
||||
// Remove all "allOf" instances, this removes nullability/descriptions
|
||||
if (typeof value === 'object' && 'allOf' in value && value.allOf.length === 1) {
|
||||
if (!!value && typeof value === 'object' && 'allOf' in value && value.allOf.length === 1) {
|
||||
return value.allOf[0];
|
||||
}
|
||||
|
||||
|
||||
return value;
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user