Skip to content

Commit

Permalink
fix(open-api): render all description fields as markdown
Browse files Browse the repository at this point in the history
INT-407
  • Loading branch information
FreekVR committed Apr 16, 2024
1 parent 92ec5d9 commit 7cd4a3c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
5 changes: 4 additions & 1 deletion src/.vuepress/theme/client/components/global/OpenApiInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
<hgroup>
<h2>{{ info.title }}</h2>
<p>(v{{ info.version }})</p>
<p v-if="info.description">{{ info.description }}</p>
<Markdown
v-if="info.description"
:content="info.description" />
</hgroup>
</section>
</template>

<script setup lang="ts">
import {type OpenAPIV3_1 as OpenApiType} from 'openapi-types';
import Markdown from './Markdown.vue';
defineProps<{
info: OpenApiType.Document['info'];
Expand Down
4 changes: 3 additions & 1 deletion src/.vuepress/theme/client/components/global/OpenApiPath.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
:security-schemes="components?.securitySchemes as Record<string, OpenApiType.SecuritySchemeObject>"
:security-requirements="'security' in operation ? operation.security : undefined" />

<p v-if="'description' in operation">{{ operation.description }}</p>
<Markdown
v-if="'description' in operation && operation.description?.length"
:content="operation.description" />

<template v-if="'parameters' in operation">
<h4>Request parameters</h4>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
v-if="parameter.schema"
:schema="parameter.schema" />

<div
<Markdown
v-if="
parameter.description &&
!(parameter.schema && 'description' in parameter.schema && parameter.schema.description?.length)
"
class="text-gray-500 text-sm"
v-html="parameter.description" />
:content="parameter.description" />

<OpenApiExample
v-if="parameter.example"
Expand Down Expand Up @@ -56,9 +56,8 @@
import {computed, defineProps} from 'vue';
import {type OpenAPIV3_1 as OpenApiType} from 'openapi-types';
import OpenApiSchema from './OpenApiSchema.vue';
// import OpenApiObjectModel from './OpenApiObjectModel.vue';
// import OpenApiMediaTypes from './OpenApiMediaTypes.vue';
import OpenApiExample from './OpenApiExample.vue';
import Markdown from './Markdown.vue';
const props = defineProps<{
parameter: OpenApiType.ParameterObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
:key="code"
class="m-0 p-0">
<Http :code="code" />
<p

<Markdown
v-if="response.description"
class="text-gray-500 text-sm">
{{ response.description }}
</p>
class="text-gray-500 text-sm"
:content="response.description" />

<template v-for="(item, type) in response.content">
<DetailsExpand
Expand Down Expand Up @@ -54,9 +54,9 @@ import {type OpenAPIV3_1 as OpenApiType} from 'openapi-types';
import {isReponseObject} from '@mptheme/client/utils/openApiGuards';
import OpenApiSchema from './OpenApiSchema.vue';
import OpenApiExample from './OpenApiExample.vue';
import Markdown from './Markdown.vue';
import Http from './Http.vue';
import DetailsExpand from './DetailsExpand.vue';
import CodeGroup from './CodeGroup.vue';
const props = defineProps<{
responses: OpenApiType.ResponsesObject;
Expand Down

0 comments on commit 7cd4a3c

Please sign in to comment.