docs: merge allOf in OAS to show all object types (#8453)

* docs: merge allOf in OAS to show all object types

* add case for non objects
This commit is contained in:
Shahed Nasser
2024-08-06 09:57:09 +03:00
committed by GitHub
parent 8700896ce6
commit 041019b319
2 changed files with 37 additions and 1 deletions
@@ -3,6 +3,7 @@ import dynamic from "next/dynamic"
import type { TagOperationParametersDefaultProps } from "../Default"
import { TagOperationParametersObjectProps } from "../Object"
import { Loading } from "docs-ui"
import mergeAllOfTypes from "../../../../../../utils/merge-all-of-types"
const TagOperationParametersObject = dynamic<TagOperationParametersObjectProps>(
async () => import("../Object"),
@@ -34,7 +35,9 @@ const TagOperationParametersUnion = ({
}: TagOperationParametersUnionProps) => {
const objectSchema = schema.anyOf
? schema.anyOf.find((item) => item.type === "object" && item.properties)
: schema.allOf?.find((item) => item.type === "object" && item.properties)
: schema.allOf
? mergeAllOfTypes(schema)
: undefined
if (!objectSchema) {
return (