-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: OAIntroduction component (#145)
- Loading branch information
1 parent
2631da4
commit 116e2f9
Showing
10 changed files
with
131 additions
and
53 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
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 was deleted.
Oops, something went wrong.
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,79 @@ | ||
--- | ||
outline: 2 | ||
--- | ||
|
||
<script setup> | ||
import ScopeConfigurationTabs from '../.vitepress/theme/components/ScopeConfigurationTabs.vue' | ||
</script> | ||
|
||
# Introduction | ||
|
||
You can use the `OAIntroduction` component to display the OpenAPI `info` and `servers` sections. | ||
|
||
<ScopeConfigurationTabs> | ||
|
||
<template #global> | ||
|
||
If you have configured the OpenAPI Specification using the `useOpenapi` composable in your `.vitepress/theme/index.[js,ts]` file, you can just use the `OAIntroduction` component in any Markdown file. | ||
|
||
```markdown | ||
<OAIntroduction /> | ||
``` | ||
|
||
</template> | ||
|
||
<template #in-markdown> | ||
|
||
In your `.md` files, import the OpenAPI specification and pass it as `spec` prop to the `OAIntroduction` component. | ||
|
||
```markdown | ||
<script setup lang="ts"> | ||
import spec from '../public/openapi.json' | ||
</script> | ||
|
||
<OAIntroduction :spec="spec" /> | ||
``` | ||
|
||
</template> | ||
|
||
</ScopeConfigurationTabs> | ||
|
||
## Example | ||
|
||
<SandboxIframe :sandbox-data="{sandboxView: 'preview', previewComponent: 'OAIntroduction', showSidebar: false}" :iframe-zoom="0.6" class="h-[70vh] max-h-[700px]" /> | ||
|
||
## Info and Servers | ||
|
||
The `OAInfo` and `OAServers` components can be used separately to display the OpenAPI `info` and `servers` sections. | ||
|
||
<ScopeConfigurationTabs> | ||
|
||
<template #global> | ||
|
||
If you have configured the OpenAPI Specification using the `useOpenapi` composable in your `.vitepress/theme/index.[js,ts]` file, you can just use the `OAInfo` and `OAServers` components in any Markdown file. | ||
|
||
```markdown | ||
<OAInfo /> | ||
|
||
<OAServers /> | ||
``` | ||
|
||
</template> | ||
|
||
<template #in-markdown> | ||
|
||
In your `.md` files, import the OpenAPI specification and pass it as `spec` prop to the `OAInfo` and `OAServers` components. | ||
|
||
```markdown | ||
<script setup lang="ts"> | ||
import spec from '../public/openapi.json' | ||
</script> | ||
|
||
<OAInfo :spec="spec" /> | ||
|
||
<OAServers :spec="spec" /> | ||
``` | ||
|
||
</template> | ||
|
||
</ScopeConfigurationTabs> |
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,7 +1,7 @@ | ||
{ | ||
"name": "vitepress-openapi", | ||
"type": "module", | ||
"version": "0.0.3-alpha.54", | ||
"version": "0.0.3-alpha.55", | ||
"packageManager": "[email protected]", | ||
"homepage": "https://vitepress-openapi.vercel.app/", | ||
"repository": { | ||
|
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,25 @@ | ||
<script setup> | ||
import { inject } from 'vue' | ||
import { getOpenApiInstance } from '../../lib/getOpenApiInstance' | ||
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', undefined), | ||
}) | ||
</script> | ||
<template> | ||
<OAInfo :spec="spec" :openapi="openapi" /> | ||
<OAServers :spec="spec" :openapi="openapi" /> | ||
</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