docs-util: fixes following packages reorg (#9326)
- Typescript config aren't picked up properly anymore since they're moved to `_tsconfig.base.json` in the root. So, we now read the config from the config file. - Update Typescript version in the `utils` monorepo to match that of the root monorepo
This commit is contained in:
@@ -37,6 +37,34 @@ class SchemaFactory {
|
||||
BigNumberValue: {
|
||||
type: "number",
|
||||
},
|
||||
expand: {
|
||||
type: "string",
|
||||
title: "expand",
|
||||
description:
|
||||
"Comma-separated relations that should be expanded in the returned data.",
|
||||
},
|
||||
fields: {
|
||||
type: "string",
|
||||
title: "fields",
|
||||
description:
|
||||
"Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default fields. without prefix it will replace the entire default fields.",
|
||||
},
|
||||
offset: {
|
||||
type: "number",
|
||||
title: "offset",
|
||||
description: "The number of items to skip when retrieving a list.",
|
||||
},
|
||||
limit: {
|
||||
type: "number",
|
||||
title: "limit",
|
||||
description: "Limit the number of items returned in the list.",
|
||||
},
|
||||
order: {
|
||||
type: "string",
|
||||
title: "order",
|
||||
description:
|
||||
"The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with `-`.",
|
||||
},
|
||||
File: {
|
||||
type: "object",
|
||||
description: "A File to upload.",
|
||||
|
||||
@@ -35,7 +35,11 @@ export default class TypesHelper {
|
||||
}
|
||||
|
||||
cleanUpTypes(types: ts.Type[]): ts.Type[] {
|
||||
let cleanedUpTypes = this.removeStringRegExpTypeOverlaps(types)
|
||||
let cleanedUpTypes = this.removeUndefinedNullTypes(types)
|
||||
|
||||
cleanedUpTypes = this.removeExtraBoolean(cleanedUpTypes)
|
||||
|
||||
cleanedUpTypes = this.removeStringRegExpTypeOverlaps(cleanedUpTypes)
|
||||
|
||||
cleanedUpTypes = this.joinDateAndString(cleanedUpTypes)
|
||||
|
||||
@@ -80,4 +84,28 @@ export default class TypesHelper {
|
||||
|
||||
return dateType && hasStringType ? [dateType] : types
|
||||
}
|
||||
|
||||
private removeUndefinedNullTypes(types: ts.Type[]): ts.Type[] {
|
||||
return types.filter(
|
||||
(type) =>
|
||||
type.flags !== ts.TypeFlags.Undefined &&
|
||||
type.flags !== ts.TypeFlags.Null
|
||||
)
|
||||
}
|
||||
|
||||
private removeExtraBoolean(types: ts.Type[]): ts.Type[] {
|
||||
let found = false
|
||||
return types.filter((tsType) => {
|
||||
if (tsType.flags !== ts.TypeFlags.BooleanLiteral) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
found = true
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user