docs-util: fixes for OAS docs generator + framework typedoc config (#9603)

* fix order replaced in OAS response + framework tsdoc config

* fix for some types
This commit is contained in:
Shahed Nasser
2024-10-16 12:17:28 +03:00
committed by GitHub
parent 714b9e6c98
commit 2b77bd85a6
4 changed files with 60 additions and 47 deletions

View File

@@ -2055,8 +2055,49 @@ class OasKindGenerator extends FunctionKindGenerator {
!Object.hasOwn(oldSchemaObj!.properties!, propertyKey)
)
.forEach((newPropertyKey) => {
oldSchemaObj!.properties![newPropertyKey] =
newSchemaObj!.properties![newPropertyKey]
const tryToUpdateSchema = (
schema: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject
) => {
let updatedSchema = schema
const newPropertySchemaName = this.oasSchemaHelper.isRefObject(
schema
)
? schema.$ref
: "x-schemaName" in schema
? (schema["x-schemaName"] as string)
: undefined
if (newPropertySchemaName) {
const schemaToUpdate = this.oasSchemaHelper.getSchemaByName(
newPropertySchemaName,
true,
true
)
if (schemaToUpdate) {
updatedSchema =
this.updateSchema({
oldSchema: schemaToUpdate.schema,
newSchema: schema,
level: maybeIncrementLevel(level, "object"),
}) || newProperty
}
}
return updatedSchema
}
let newProperty = newSchemaObj!.properties![newPropertyKey]
if (
!this.oasSchemaHelper.isRefObject(newProperty) &&
newProperty.type === "array"
) {
newProperty.items = tryToUpdateSchema(newProperty.items)
} else {
newProperty = tryToUpdateSchema(newProperty)
}
oldSchemaObj!.properties![newPropertyKey] = newProperty
})
}
} else if (