Fix circularRef in schema + examples OpenAPI (#2872)

This commit is contained in:
Nolann B.
2025-02-24 21:26:26 +01:00
committed by GitHub
parent a0545545d7
commit b4a12d606e
3 changed files with 31 additions and 16 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@gitbook/react-openapi': patch
---
Fix circularRef in schema + examples OpenAPI
@@ -59,6 +59,9 @@ export function OpenAPISchemaProperty(
context={context} context={context}
/> />
))} ))}
{parentCircularRef ? (
<OpenAPISchemaCircularRef id={parentCircularRef} schema={schema} />
) : null}
</InteractiveSection> </InteractiveSection>
); );
} }
@@ -76,6 +79,9 @@ export function OpenAPISchemaProperty(
/> />
</OpenAPIDisclosure> </OpenAPIDisclosure>
) : null} ) : null}
{parentCircularRef ? (
<OpenAPISchemaCircularRef id={parentCircularRef} schema={schema} />
) : null}
</InteractiveSection> </InteractiveSection>
); );
} }
@@ -16,7 +16,9 @@ export function generateSchemaExample(
schema: OpenAPIV3.SchemaObject, schema: OpenAPIV3.SchemaObject,
options?: GenerateSchemaExampleOptions, options?: GenerateSchemaExampleOptions,
): JSONValue | undefined { ): JSONValue | undefined {
return getExampleFromSchema(schema, { return getExampleFromSchema(
schema,
{
emptyString: 'text', emptyString: 'text',
variables: { variables: {
'date-time': new Date().toISOString(), 'date-time': new Date().toISOString(),
@@ -32,7 +34,9 @@ export function generateSchemaExample(
password: 'password', password: 'password',
}, },
...options, ...options,
}); },
3, // Max depth for circular references
);
} }
/** /**