-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
97908fd
commit 27f0ab5
Showing
40 changed files
with
992 additions
and
674 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<script setup> | ||
import { inject, provide } from 'vue' | ||
import { OPENAPI_GLOBAL_KEY, OPENAPI_LOCAL_KEY } from '../../composables/useOpenapi' | ||
import { getAsyncOpenApiInstance } from '../../lib/getAsyncOpenApiInstance' | ||
const props = defineProps({ | ||
spec: { | ||
type: Object, | ||
required: false, | ||
default: null, | ||
}, | ||
}) | ||
const globalOpenApi = inject(OPENAPI_GLOBAL_KEY, undefined) | ||
const openapi | ||
= await getAsyncOpenApiInstance({ | ||
custom: { spec: props.spec }, | ||
injected: globalOpenApi, | ||
}) | ||
provide(OPENAPI_LOCAL_KEY, openapi) | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<slot :openapi="openapi" /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<script setup> | ||
import OAContext from './OAContext.vue' | ||
const props = defineProps({ | ||
spec: { | ||
type: Object, | ||
required: false, | ||
default: null, | ||
}, | ||
}) | ||
</script> | ||
|
||
<template> | ||
<Suspense> | ||
<OAContext :spec="props.spec"> | ||
<template #default="{ openapi }"> | ||
<slot :openapi="openapi" /> | ||
</template> | ||
</OAContext> | ||
</Suspense> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,108 +1,19 @@ | ||
<script setup> | ||
import { inject } from 'vue' | ||
import { OPENAPI_GLOBAL_KEY, OPENAPI_LOCAL_KEY } from '../../composables/useOpenapi' | ||
import { getOpenApiInstance } from '../../lib/getOpenApiInstance' | ||
import { Badge } from '../ui/badge/index' | ||
import OAContextProvider from './OAContextProvider.vue' | ||
import OAInfoContent from './OAInfoContent.vue' | ||
const props = defineProps({ | ||
spec: { | ||
type: Object, | ||
required: false, | ||
}, | ||
openapi: { | ||
type: Object, | ||
required: false, | ||
}, | ||
}) | ||
const openapi = props.openapi ?? getOpenApiInstance({ | ||
custom: { spec: props.spec }, | ||
injected: inject(OPENAPI_GLOBAL_KEY, undefined), | ||
injectedLocal: inject(OPENAPI_LOCAL_KEY, undefined), | ||
}) | ||
const info = openapi.getInfo() | ||
const externalDocs = openapi.getExternalDocs() | ||
</script> | ||
|
||
<template> | ||
<div class="flex flex-col"> | ||
<div class="flex flex-col items-start"> | ||
<div class="flex flex-row items-center gap-2"> | ||
<Badge | ||
v-if="info.version" | ||
variant="outline" | ||
> | ||
v{{ info.version }} | ||
</Badge> | ||
</div> | ||
<OAHeading level="h1"> | ||
{{ info.title ?? $t('API Documentation') }} | ||
</OAHeading> | ||
</div> | ||
<span v-if="info.summary" class="text-gray-600 dark:text-gray-300"> | ||
{{ info.summary }} | ||
</span> | ||
<OAMarkdown | ||
v-if="info.description" | ||
:content="info.description" | ||
class="mt-4" | ||
/> | ||
<template v-if="info.contact"> | ||
<OAHeading level="h2"> | ||
{{ $t('Contact') }} | ||
</OAHeading> | ||
<div class="flex flex-row items-center gap-2"> | ||
<template v-if="info.contact.url"> | ||
<a :href="info.contact.url" :aria-label="info.contact.name ?? $t('Contact')"> | ||
{{ info.contact.name ?? $t('Contact') }} | ||
</a> | ||
<span v-if="info.contact.email" class="text-gray-400 dark:text-gray-500">/</span> | ||
</template> | ||
<a v-if="info.contact.email" :href="`mailto:${info.contact.email}`" :aria-label="info.contact.email"> | ||
{{ info.contact.email }} | ||
</a> | ||
</div> | ||
</template> | ||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2"> | ||
<div v-if="info.termsOfService"> | ||
<OAHeading level="h2"> | ||
{{ $t('Terms of Service') }} | ||
</OAHeading> | ||
<a :href="info.termsOfService" :aria-label="info.termsOfService"> | ||
{{ info.termsOfService }} | ||
</a> | ||
</div> | ||
<div v-if="info.license"> | ||
<OAHeading level="h2"> | ||
{{ $t('License') }} | ||
</OAHeading> | ||
<a :href="info.license.url" :aria-label="info.license.name"> | ||
{{ info.license.name ?? $t('License') }} | ||
</a> | ||
</div> | ||
</div> | ||
<template v-if="Object.keys(externalDocs).length"> | ||
<OAHeading level="h2"> | ||
{{ $t('External Documentation') }} | ||
</OAHeading> | ||
<a :href="externalDocs.url" :aria-label="externalDocs.description ?? $t('External Documentation')"> | ||
{{ externalDocs.description ?? $t('External Documentation') }} | ||
</a> | ||
<OAContextProvider :spec="props.spec"> | ||
<template #default="{ openapi }"> | ||
<OAInfoContent :openapi="openapi" /> | ||
</template> | ||
</div> | ||
</OAContextProvider> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<script setup> | ||
import { Badge } from '../ui/badge/index' | ||
const props = defineProps({ | ||
openapi: { | ||
type: Object, | ||
required: true, | ||
}, | ||
}) | ||
const info = props.openapi.parsedSpec.info | ||
const externalDocs = props.openapi.parsedSpec.externalDocs | ||
</script> | ||
|
||
<template> | ||
<div class="flex flex-col"> | ||
<div class="flex flex-col items-start"> | ||
<div class="flex flex-row items-center gap-2"> | ||
<Badge | ||
v-if="info.version" | ||
variant="outline" | ||
> | ||
v{{ info.version }} | ||
</Badge> | ||
</div> | ||
|
||
<OAHeading level="h1"> | ||
{{ info.title ?? $t('API Documentation') }} | ||
</OAHeading> | ||
</div> | ||
|
||
<span v-if="info.summary" class="text-gray-600 dark:text-gray-300"> | ||
{{ info.summary }} | ||
</span> | ||
|
||
<OAMarkdown | ||
v-if="info.description" | ||
:content="info.description" | ||
class="mt-4" | ||
/> | ||
|
||
<template v-if="info.contact"> | ||
<OAHeading level="h2"> | ||
{{ $t('Contact') }} | ||
</OAHeading> | ||
|
||
<div class="flex flex-row items-center gap-2"> | ||
<template v-if="info.contact.url"> | ||
<a :href="info.contact.url" :aria-label="info.contact.name ?? $t('Contact')"> | ||
{{ info.contact.name ?? $t('Contact') }} | ||
</a> | ||
|
||
<span v-if="info.contact.email" class="text-gray-400 dark:text-gray-500">/</span> | ||
</template> | ||
|
||
<a v-if="info.contact.email" :href="`mailto:${info.contact.email}`" :aria-label="info.contact.email"> | ||
{{ info.contact.email }} | ||
</a> | ||
</div> | ||
</template> | ||
|
||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2"> | ||
<div v-if="info.termsOfService"> | ||
<OAHeading level="h2"> | ||
{{ $t('Terms of Service') }} | ||
</OAHeading> | ||
|
||
<a :href="info.termsOfService" :aria-label="info.termsOfService"> | ||
{{ info.termsOfService }} | ||
</a> | ||
</div> | ||
|
||
<div v-if="info.license"> | ||
<OAHeading level="h2"> | ||
{{ $t('License') }} | ||
</OAHeading> | ||
|
||
<a :href="info.license.url" :aria-label="info.license.name"> | ||
{{ info.license.name ?? $t('License') }} | ||
</a> | ||
</div> | ||
</div> | ||
|
||
<template v-if="Object.keys(externalDocs).length"> | ||
<OAHeading level="h2"> | ||
{{ $t('External Documentation') }} | ||
</OAHeading> | ||
|
||
<a :href="externalDocs.url" :aria-label="externalDocs.description ?? $t('External Documentation')"> | ||
{{ externalDocs.description ?? $t('External Documentation') }} | ||
</a> | ||
</template> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,20 @@ | ||
<script setup> | ||
import { inject } from 'vue' | ||
import { OPENAPI_GLOBAL_KEY, OPENAPI_LOCAL_KEY } from '../../composables/useOpenapi' | ||
import { getOpenApiInstance } from '../../lib/getOpenApiInstance' | ||
import OAInfoContent from './OAInfoContent.vue' | ||
import OAServersContent from './OAServersContent.vue' | ||
const props = defineProps({ | ||
spec: { | ||
type: Object, | ||
required: false, | ||
}, | ||
openapi: { | ||
type: Object, | ||
required: false, | ||
}, | ||
}) | ||
const openapi = props.openapi ?? getOpenApiInstance({ | ||
custom: { spec: props.spec }, | ||
injected: inject(OPENAPI_GLOBAL_KEY, undefined), | ||
injectedLocal: inject(OPENAPI_LOCAL_KEY, undefined), | ||
}) | ||
</script> | ||
|
||
<template> | ||
<OAInfo :spec="spec" :openapi="openapi" /> | ||
<OAServers :spec="spec" :openapi="openapi" /> | ||
<OAContextProvider :spec="props.spec"> | ||
<template #default="{ openapi }"> | ||
<OAInfoContent :openapi="openapi" /> | ||
<OAServersContent :openapi="openapi" /> | ||
</template> | ||
</OAContextProvider> | ||
</template> |
Oops, something went wrong.