UNPKG

vitepress-openapi

Version:

Generate VitePress API Documentation from OpenAPI Specification.

32 lines (24 loc) 716 B
export function getPropertyExample(property: any): any { if (property?.example !== undefined) { return property.example } if (property?.examples && property?.examples?.length > 0) { return property.examples[0] } if (property?.schema?.example !== undefined) { return property.schema.example } if (property?.schema?.examples && property?.schema?.examples?.length > 0) { const firstExample = property.schema.examples[0] if (firstExample) { return firstExample } } if (property?.subexample !== undefined) { return property.subexample } if (property?.subexamples && property?.subexamples?.length > 0) { return property.subexamples[0] } return null }