
Security News
High Salaries No Longer Enough to Attract Top Cybersecurity Talent
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
@scalar/api-reference
Advanced tools
Generate interactive API documentations from Swagger files. Try our Demo
npm install @scalar/api-reference
<script setup>
import { ApiReference } from '@scalar/api-reference'
</script>
<template>
<ApiReference />
</template>
You can even mount the component in React.
There’s a configuration object that can be used on all platforms. In Vue.js, you use it like this:
Whether the Swagger editor should be shown.
<ApiReference :configuration="{ isEditable: true }" />
Directly pass an OpenAPI/Swagger spec.
<ApiReference :configuration="{ spec: { content: '{ … }' } }" />
Pass the URL of a spec file (JSON or Yaml).
<ApiReference :configuration="{ spec: { url: '/swagger.json' } }" />
Making requests to other domains is restricted in the browser and requires CORS headers. It’s recommended to use a proxy to send requests to other origins.
<ApiReference :configuration="{ proxy: 'https://proxy.example.com' }" />
ℹ️ You can use @scalar/api-client-proxy to host your own proxy or you can just use ours:
<ApiReference
:configuration="{ proxy: 'https://api.scalar.com/request-proxy' }" />
Whether the sidebar should be shown.
<ApiReference :configuration="{ showSidebar: true} />
You can pass custom CSS directly to the component. This is helpful for the integrations for Fastify, Express, Hono and others where you it’s easier to add CSS to the configuration.
In Vue or React you’d probably use other ways to add custom CSS.
<script setup>
const customCss = `* { font-family: "Comic Sans MS", cursive, sans-serif; }`
</script>
<template>
<ApiReference :configuration="{ customCss }" />
</template>
Key used with CNTRL/CMD to open the search modal (defaults to 'k' e.g. CMD+k)
<ApiReference :configuration="{ searchHotKey: 'l'} />
You can pass information to the config object to configure meta information out of the box.
<ApiReference :configuration="{
metaData: {
title: 'Page title',
description: 'My page page',
ogDescription: 'Still about my my page',
ogTitle: 'Page title',
ogImage: 'https://example.com/image.png',
twitterCard: 'summary_large_image',
//Add more...
}
} />
You can pass an array of httpsnippet clients to hide from the clients menu.
<ApiReference :configuration="{
hiddenClients: ['fetch']
} />
By default hides Unirest, pass []
to show all clients
You can listen to spec changes with onSpecUpdate that runs on spec/swagger content change
<ApiReference :configuration="{
onSpecUpdate: (value: string) => {
console.log('Content updated:', value)
}
} />
To make authentication easier you can prefill the credentials for your users:
<ApiReference :configuration="{
authentication: {
// The OpenAPI file has keys for all security schemes
// Which one should be used by default?
securitySchemeKey: 'api_key',
// Okay, the `api_key` security scheme is of type `apiKey`, so prefill the token:
apiKey: {
token: 'super-secret-token',
},
},
} />
``
For OpenAuth2 it’s more looking like this:
```vue
<ApiReference :configuration="{
authentication: {
// The OpenAPI file has keys for all security schemes
// Which one should be used by default?
securitySchemeKey: 'petstore_auth',
// Okay, the `api_key` security scheme is of type `oAuth2`, so prefill the client id and the scopes:
oAuth2: {
clientId: 'foobar123',
// optional:
scopes: ['read:pets', 'write:pets'],
},
},
} />
FAQs
generate beautiful API references from OpenAPI specs
The npm package @scalar/api-reference receives a total of 30,938 weekly downloads. As such, @scalar/api-reference popularity was classified as popular.
We found that @scalar/api-reference demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.
Security News
Corepack will be phased out from future Node.js releases following a TSC vote.