mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-12 05:48:57 +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}
|
||||
/>
|
||||
))}
|
||||
{parentCircularRef ? (
|
||||
<OpenAPISchemaCircularRef id={parentCircularRef} schema={schema} />
|
||||
) : null}
|
||||
</InteractiveSection>
|
||||
);
|
||||
}
|
||||
@@ -76,6 +79,9 @@ export function OpenAPISchemaProperty(
|
||||
/>
|
||||
</OpenAPIDisclosure>
|
||||
) : null}
|
||||
{parentCircularRef ? (
|
||||
<OpenAPISchemaCircularRef id={parentCircularRef} schema={schema} />
|
||||
) : null}
|
||||
</InteractiveSection>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,23 +16,27 @@ export function generateSchemaExample(
|
||||
schema: OpenAPIV3.SchemaObject,
|
||||
options?: GenerateSchemaExampleOptions,
|
||||
): JSONValue | undefined {
|
||||
return getExampleFromSchema(schema, {
|
||||
emptyString: 'text',
|
||||
variables: {
|
||||
'date-time': new Date().toISOString(),
|
||||
date: new Date().toISOString().split('T')[0],
|
||||
email: 'name@gmail.com',
|
||||
hostname: 'example.com',
|
||||
ipv4: '0.0.0.0',
|
||||
ipv6: '2001:0db8:85a3:0000:0000:8a2e:0370:7334',
|
||||
uri: 'https://example.com',
|
||||
uuid: '123e4567-e89b-12d3-a456-426614174000',
|
||||
binary: 'binary',
|
||||
byte: 'Ynl0ZXM=',
|
||||
password: 'password',
|
||||
return getExampleFromSchema(
|
||||
schema,
|
||||
{
|
||||
emptyString: 'text',
|
||||
variables: {
|
||||
'date-time': new Date().toISOString(),
|
||||
date: new Date().toISOString().split('T')[0],
|
||||
email: 'name@gmail.com',
|
||||
hostname: 'example.com',
|
||||
ipv4: '0.0.0.0',
|
||||
ipv6: '2001:0db8:85a3:0000:0000:8a2e:0370:7334',
|
||||
uri: 'https://example.com',
|
||||
uuid: '123e4567-e89b-12d3-a456-426614174000',
|
||||
binary: 'binary',
|
||||
byte: 'Ynl0ZXM=',
|
||||
password: 'password',
|
||||
},
|
||||
...options,
|
||||
},
|
||||
...options,
|
||||
});
|
||||
3, // Max depth for circular references
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user