Operation Badges
Each operation can have different badges that indicate its state, for example if it is deprecated, the operation id, etc. The available badges are:
deprecated
operationId
By default, only the deprecated
badge is shown, as appropriate. You can customize the operation badges using the useTheme({ operation: { badges: string[] })
function. The order in which you set the badges is the order in which they will be displayed.
---
aside: false
outline: false
title: vitepress-openapi
---
<script setup lang="ts">
import { useData } from 'vitepress'
import { useTheme } from 'vitepress-openapi'
const { isDark } = useData()
useTheme({
operation: {
badges: ['deprecated', 'operationId'],
},
})
</script>
<OASpec :isDark="isDark" />
Example
Argentine Rock Legends
The Argentine Rock Legends is an example OpenAPI specification to test OpenAPI tools and libraries. Get all the data for all artists.
Inspired by Scalar Galaxy
Resources
- https://github.com/enzonotario/vitepress-openapi
- https://github.com/OAI/OpenAPI-Specification
Markdown Support
All descriptions can contain tons of text Markdown. If GitHub supports the syntax, chances are we’re supporting it, too. You can even create internal links to reference endpoints.
Examples
Blockquotes
I love Argentine Rock. <3
Tables
Feature | Availability |
---|---|
Markdown Support | ✓ |
Accordion
<details>
<summary>Using Details Tags</summary>
<p>HTML Example</p>
</details>
Images
Yes, there’s support for images, too!
Contact
Servers
Artists
Everything about Argentine Rock artists
Add a new artist
Add a new legendary Argentine Rock artist. Make sure they truly deserve the title!
Authorizations
Request Body
Responses
Samples
post {
url: https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists
}
headers {
Content-Type: application/json
}
curl -X POST \
'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists' \
-H "Content-Type: application/json"
fetch('https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists', {method:'POST',headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = 'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists';
$method = 'POST';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
import requests
url = 'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists'
headers = {
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers)
print(response.json())
Get an artist
Learn more about a specific Argentine Rock artist and their legacy.
Parameters
Path Parameters
1
int64
Responses
Samples
get {
url: https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1
}
headers {
Content-Type: application/json
}
curl -X GET \
'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1' \
-H "Content-Type: application/json"
fetch('https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1', {headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = 'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1';
$method = 'GET';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
import requests
url = 'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1'
headers = {
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers)
print(response.json())
Update an artist
Update the information of a legendary Argentine Rock artist. Make sure to provide accurate data.
Authorizations
Parameters
Path Parameters
1
int64
Request Body
Responses
Samples
put {
url: https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1
}
headers {
Content-Type: application/json
}
curl -X PUT \
'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1' \
-H "Content-Type: application/json"
fetch('https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1', {method:'PUT',headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = 'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1';
$method = 'PUT';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
import requests
url = 'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1'
headers = {
'Content-Type': 'application/json'
}
response = requests.put(url, headers=headers)
print(response.json())
Delete an artist
This endpoint was used to delete artists. Unfortunately, that caused a lot of controversy. So, this endpoint is now deprecated and should not be used anymore.
Authorizations
Parameters
Path Parameters
1
int64
Responses
Samples
delete {
url: https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1
}
headers {
Content-Type: application/json
}
curl -X DELETE \
'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1' \
-H "Content-Type: application/json"
fetch('https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1', {method:'DELETE',headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = 'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1';
$method = 'DELETE';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
import requests
url = 'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1'
headers = {
'Content-Type': 'application/json'
}
response = requests.delete(url, headers=headers)
print(response.json())
Get all albums
Get a list of all albums from a legendary Argentine Rock artist.
Parameters
Path Parameters
1
int64
Query Parameters
The number of items to return
10
20
50
int64
10
The number of items to skip before starting to collect the result set
1
23
456
int64
0
Responses
Samples
get {
url: https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1/albums?limit=10&offset=1
}
headers {
Content-Type: application/json
}
curl -X GET \
'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1/albums?limit=10&offset=1' \
-H "Content-Type: application/json"
fetch('https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1/albums?limit=10&offset=1', {headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = 'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1/albums';
$method = 'GET';
$headers = [
'Content-Type' => 'application/json',
];
$query = http_build_query([
'limit' => '10',
'offset' => '1',
]);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url . '?' . $query);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
import requests
url = 'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1/albums'
params = {
'limit': 10,
'offset': 1
}
headers = {
'Content-Type': 'application/json'
}
response = requests.get(url, params=params, headers=headers)
print(response.json())
Add a new album
Add a new album to a legendary Argentine Rock artist. Make sure it’s a masterpiece!
Authorizations
Parameters
Path Parameters
1
int64
Request Body
Responses
Samples
post {
url: https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1/albums
}
headers {
Content-Type: application/json
}
curl -X POST \
'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1/albums' \
-H "Content-Type: application/json"
fetch('https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1/albums', {method:'POST',headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = 'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1/albums';
$method = 'POST';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
import requests
url = 'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/artists/1/albums'
headers = {
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers)
print(response.json())
Authentication
Some endpoints are public, but some require authentication. We provide all the required endpoints to create an account and authorize yourself.
Operations
Create a user
Create a user account to access exclusive content about Argentine Rock legends.
Request Body
Responses
Samples
post {
url: https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/user/signup
}
headers {
Content-Type: application/json
}
curl -X POST \
'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/user/signup' \
-H "Content-Type: application/json"
fetch('https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/user/signup', {method:'POST',headers:{'Content-Type':'application/json'}})
.then(response => response.json())
.then(data => console.log(data));
<?php
$url = 'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/user/signup';
$method = 'POST';
$headers = [
'Content-Type' => 'application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
import requests
url = 'https://stoplight.io/mocks/enzonotario/argentine-rock/122547792/api/v1/user/signup'
headers = {
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers)
print(response.json())
Custom Prefix
You can also customize the prefix of the badges by setting the operation.badgePrefix.{badgeName}
key in the i18n messages. For example, in your .vitepress/theme/index.ts
, before calling theme.enhanceApp({ app })
, you can set the following:
import { locales, theme, useTheme } from 'vitepress-openapi'
import DefaultTheme from 'vitepress/theme'
import 'vitepress-openapi/dist/style.css'
export default {
extends: DefaultTheme,
enhanceApp({ app }) {
useTheme({
i18n: {
messages: {
en: {
...locales.en,
'operation.badgePrefix.operationId': 'Operation ID: ',
},
es: {
...locales.es,
'operation.badgePrefix.operationId': 'ID de operación: ',
},
},
},
})
// Use the theme.
theme.enhanceApp({ app })
},
}