mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-25 03:42:30 +00:00
Fix circularRef in schema + examples OpenAPI (#2872)
This commit is contained in:
@@ -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
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user