import yaml from 'js-yaml';
import type { OpenAPIV3 } from '@gitbook/openapi-parser';
import type { OpenAPIContext, OpenAPIUniversalContext } from './context';
import { json2xml } from './json2xml';
import { stringifyOpenAPI } from './stringifyOpenAPI';
import { t } from './translate';
/**
* Display an example.
*/
export function OpenAPIExample(props: {
example: OpenAPIV3.ExampleObject;
context: OpenAPIContext;
syntax: string;
}) {
const { example, context, syntax } = props;
const code = stringifyExample({ example, syntax });
if (code === null) {
return
{t(context.translation, 'no_content')}
);
}