MCPcopy Create free account
hub / github.com/GitbookIO/gitbook / getExamples

Function getExamples

packages/react-openapi/src/util/example.tsx:96–114  ·  view source on GitHub ↗
(props: {
    mediaTypeObject: OpenAPIV3.MediaTypeObject;
    mediaType: string;
    context: OpenAPIContext;
})

Source from the content-addressed store, hash-verified

94 * Get the examples from a media type object.
95 */
96export function getExamples(props: {
97 mediaTypeObject: OpenAPIV3.MediaTypeObject;
98 mediaType: string;
99 context: OpenAPIContext;
100}) {
101 const { mediaTypeObject, mediaType, context } = props;
102 const examples = getExamplesFromMediaTypeObject({ mediaTypeObject, mediaType, context });
103 const syntax = getSyntaxFromMediaType(mediaType);
104
105 return examples.map((example) => {
106 return {
107 key: example.key,
108 label: example.example.summary || example.key,
109 body: (
110 <OpenAPIExample example={example.example} context={props.context} syntax={syntax} />
111 ),
112 };
113 });
114}
115
116/**
117 * Get the syntax from a media type.

Callers 2

OpenAPIWebhookExampleFunction · 0.90
OpenAPIResponseFunction · 0.90

Calls 2

getSyntaxFromMediaTypeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…