@scalar/api-reference 1.29.2 → 1.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/README.md +13 -114
- package/dist/browser/standalone.js +2402 -2306
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/Content/Introduction/Introduction.vue.js +2 -2
- package/dist/components/Content/Introduction/Introduction.vue2.js +1 -1
- package/dist/components/Content/Schema/Schema.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/Schema.vue.js +2 -2
- package/dist/components/Content/Schema/Schema.vue2.js +118 -84
- package/dist/components/Content/Schema/SchemaComposition.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaComposition.vue.js +62 -60
- package/dist/components/Content/Schema/SchemaDiscriminator.vue.d.ts +13 -0
- package/dist/components/Content/Schema/SchemaDiscriminator.vue.d.ts.map +1 -0
- package/dist/components/Content/Schema/SchemaDiscriminator.vue.js +49 -0
- package/dist/components/Content/Schema/SchemaDiscriminator.vue2.js +4 -0
- package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.js +2 -2
- package/dist/components/Content/Schema/SchemaProperty.vue2.js +40 -39
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js +2 -2
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue2.js +133 -114
- package/dist/components/Content/Schema/helpers/schema-discriminator.d.ts +9 -1
- package/dist/components/Content/Schema/helpers/schema-discriminator.d.ts.map +1 -1
- package/dist/components/Content/Schema/helpers/schema-discriminator.js +45 -0
- package/dist/components/Section/SectionHeaderTag.vue.d.ts.map +1 -1
- package/dist/components/Section/SectionHeaderTag.vue.js +2 -2
- package/dist/features/ApiClientModal/useApiClient.d.ts +28 -8
- package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
- package/dist/features/Operation/components/callbacks/Callback.vue.d.ts +14 -0
- package/dist/features/Operation/components/callbacks/Callback.vue.d.ts.map +1 -0
- package/dist/features/Operation/components/callbacks/Callback.vue.js +7 -0
- package/dist/features/Operation/components/callbacks/Callback.vue2.js +62 -0
- package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts +10 -0
- package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts.map +1 -0
- package/dist/features/Operation/components/callbacks/Callbacks.vue.js +30 -0
- package/dist/features/Operation/components/callbacks/Callbacks.vue2.js +4 -0
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +2 -2
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue2.js +86 -74
- package/dist/features/Operation/types/schemas.d.ts +3 -0
- package/dist/features/Operation/types/schemas.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @scalar/api-reference
|
|
2
2
|
|
|
3
|
+
## 1.30.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5208e7a: fix: decreases level on single property schema
|
|
8
|
+
- edb5490: feat: adds schema discriminator helper functions
|
|
9
|
+
- 442c0a3: feat: added support for callbacks
|
|
10
|
+
- edb5490: feat: adds schema discriminator support
|
|
11
|
+
- Updated dependencies [151ef09]
|
|
12
|
+
- Updated dependencies [442c0a3]
|
|
13
|
+
- Updated dependencies [edf694b]
|
|
14
|
+
- @scalar/api-client@2.4.4
|
|
15
|
+
- @scalar/oas-utils@0.3.2
|
|
16
|
+
- @scalar/openapi-parser@0.12.0
|
|
17
|
+
- @scalar/components@0.14.2
|
|
18
|
+
|
|
19
|
+
## 1.29.3
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- fbcce50: fix: moves download link to section column in introduction component
|
|
24
|
+
- 0afb11d: fix: asses schemas to children object in schema property
|
|
25
|
+
- 9fd408c: fix: updates schema property heading type handling
|
|
26
|
+
- 0afb11d: fix: adds model name function in schema property heading
|
|
27
|
+
- c944864: fix: updates schema composition style and missing value
|
|
28
|
+
- 9ffba73: fix: displays schema references name in property heading
|
|
29
|
+
- Updated dependencies [fbcce50]
|
|
30
|
+
- @scalar/api-client@2.4.3
|
|
31
|
+
|
|
3
32
|
## 1.29.2
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -6,29 +6,10 @@
|
|
|
6
6
|
[](https://www.npmjs.com/package/@scalar/api-reference)
|
|
7
7
|
[](https://discord.gg/scalar)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Interactive API Reference from OpenAPI/Swagger Documents [Try our Demo](https://docs.scalar.com/swagger-editor)
|
|
10
10
|
|
|
11
11
|
[](https://docs.scalar.com/swagger-editor)
|
|
12
12
|
|
|
13
|
-
## Installation
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm install @scalar/api-reference
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
```vue
|
|
22
|
-
<script setup>
|
|
23
|
-
import { ApiReference } from '@scalar/api-reference'
|
|
24
|
-
import '@scalar/api-reference/style.css'
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
<template>
|
|
28
|
-
<ApiReference />
|
|
29
|
-
</template>
|
|
30
|
-
```
|
|
31
|
-
|
|
32
13
|
### CDN
|
|
33
14
|
|
|
34
15
|
```html
|
|
@@ -41,108 +22,26 @@ import '@scalar/api-reference/style.css'
|
|
|
41
22
|
name="viewport"
|
|
42
23
|
content="width=device-width, initial-scale=1" />
|
|
43
24
|
</head>
|
|
25
|
+
|
|
44
26
|
<body>
|
|
45
|
-
|
|
46
|
-
<!-- Note: We’re using our public proxy to avoid CORS issues. You can remove the `data-proxy-url` attribute if you don’t need it. -->
|
|
47
|
-
<script
|
|
48
|
-
id="api-reference"
|
|
49
|
-
data-url="https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.yaml"
|
|
50
|
-
data-proxy-url="https://proxy.scalar.com"></script>
|
|
27
|
+
<div id="app"></div>
|
|
51
28
|
|
|
52
|
-
<!--
|
|
53
|
-
<script>
|
|
54
|
-
var configuration = {
|
|
55
|
-
theme: 'purple',
|
|
56
|
-
}
|
|
29
|
+
<!-- Load the Script -->
|
|
30
|
+
<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
|
|
57
31
|
|
|
58
|
-
|
|
59
|
-
|
|
32
|
+
<!-- Initialize the Scalar API Reference -->
|
|
33
|
+
<script>
|
|
34
|
+
Scalar.createApiReference('#app', {
|
|
35
|
+
// The URL of the OpenAPI/Swagger document
|
|
36
|
+
url: 'https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.json',
|
|
37
|
+
// Avoid CORS issues
|
|
38
|
+
proxyUrl: 'https://proxy.scalar.com',
|
|
39
|
+
})
|
|
60
40
|
</script>
|
|
61
|
-
|
|
62
|
-
<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
|
|
63
41
|
</body>
|
|
64
42
|
</html>
|
|
65
43
|
```
|
|
66
44
|
|
|
67
|
-
You can also use the following syntax to directly pass an OpenAPI specification:
|
|
68
|
-
|
|
69
|
-
```html
|
|
70
|
-
<script
|
|
71
|
-
id="api-reference"
|
|
72
|
-
type="application/json">
|
|
73
|
-
{ … }
|
|
74
|
-
</script>
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
If you’d like to add a request proxy for the API client (to avoid CORS issues):
|
|
78
|
-
|
|
79
|
-
```html
|
|
80
|
-
<script
|
|
81
|
-
id="api-reference"
|
|
82
|
-
type="application/json"
|
|
83
|
-
data-proxy-url="https://proxy.scalar.com">
|
|
84
|
-
{ … }
|
|
85
|
-
</script>
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
#### Events [beta]
|
|
89
|
-
|
|
90
|
-
We have recently added two events to the standalone CDN build only.
|
|
91
|
-
|
|
92
|
-
##### scalar:reload-references
|
|
93
|
-
|
|
94
|
-
Reload the references, this will re-mount the app in case you have switched pages or the dom
|
|
95
|
-
elements have been removed.
|
|
96
|
-
|
|
97
|
-
```ts
|
|
98
|
-
document.dispatchEvent(new Event('scalar:reload-references'))
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
##### scalar:update-references-config
|
|
102
|
-
|
|
103
|
-
If you have updated the config or spec, you can trigger this event with the new payload to update
|
|
104
|
-
the app. It should update reactively so you do not need to trigger the reload event above after.
|
|
105
|
-
|
|
106
|
-
```ts
|
|
107
|
-
import { type ReferenceProps } from './types'
|
|
108
|
-
|
|
109
|
-
const ev = new CustomEvent('scalar:update-references-config', {
|
|
110
|
-
detail: {
|
|
111
|
-
configuration: {
|
|
112
|
-
url: 'https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.yaml',
|
|
113
|
-
},
|
|
114
|
-
} satisfies ReferenceProps,
|
|
115
|
-
})
|
|
116
|
-
document.dispatchEvent(ev)
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
## Vue.js
|
|
120
|
-
|
|
121
|
-
The API Reference is built in Vue.js. If you’re working in Vue.js, too, you can directly use our Vue components.
|
|
122
|
-
Install them via `npm`:
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
npm install @scalar/api-reference
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
And import the `ApiReference` component and style to your app:
|
|
129
|
-
|
|
130
|
-
```vue
|
|
131
|
-
<script setup lang="ts">
|
|
132
|
-
import { ApiReference } from '@scalar/api-reference'
|
|
133
|
-
import '@scalar/api-reference/style.css'
|
|
134
|
-
</script>
|
|
135
|
-
|
|
136
|
-
<template>
|
|
137
|
-
<ApiReference
|
|
138
|
-
:configuration="{
|
|
139
|
-
url: 'https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.yaml',
|
|
140
|
-
}" />
|
|
141
|
-
</template>
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
You can [pass props to customize the API reference](https://github.com/scalar/scalar/tree/main/documentation/configuration.md).
|
|
145
|
-
|
|
146
45
|
## Community
|
|
147
46
|
|
|
148
47
|
We are API nerds. You too? Let’s chat on Discord: <https://discord.gg/scalar>
|