@scalar/api-reference 1.29.3 → 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.
Files changed (38) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +13 -114
  3. package/dist/browser/standalone.js +1864 -1773
  4. package/dist/browser/webpack-stats.json +1 -1
  5. package/dist/components/Content/Schema/Schema.vue.d.ts.map +1 -1
  6. package/dist/components/Content/Schema/Schema.vue.js +2 -2
  7. package/dist/components/Content/Schema/Schema.vue2.js +118 -84
  8. package/dist/components/Content/Schema/SchemaDiscriminator.vue.d.ts +13 -0
  9. package/dist/components/Content/Schema/SchemaDiscriminator.vue.d.ts.map +1 -0
  10. package/dist/components/Content/Schema/SchemaDiscriminator.vue.js +49 -0
  11. package/dist/components/Content/Schema/SchemaDiscriminator.vue2.js +4 -0
  12. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
  13. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js +3 -3
  14. package/dist/components/Content/Schema/SchemaPropertyHeading.vue2.js +123 -119
  15. package/dist/components/Content/Schema/helpers/schema-discriminator.d.ts +9 -1
  16. package/dist/components/Content/Schema/helpers/schema-discriminator.d.ts.map +1 -1
  17. package/dist/components/Content/Schema/helpers/schema-discriminator.js +45 -0
  18. package/dist/components/Section/SectionHeaderTag.vue.d.ts.map +1 -1
  19. package/dist/components/Section/SectionHeaderTag.vue.js +2 -2
  20. package/dist/features/ApiClientModal/useApiClient.d.ts +28 -8
  21. package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
  22. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts +14 -0
  23. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts.map +1 -0
  24. package/dist/features/Operation/components/callbacks/Callback.vue.js +7 -0
  25. package/dist/features/Operation/components/callbacks/Callback.vue2.js +62 -0
  26. package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts +10 -0
  27. package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts.map +1 -0
  28. package/dist/features/Operation/components/callbacks/Callbacks.vue.js +30 -0
  29. package/dist/features/Operation/components/callbacks/Callbacks.vue2.js +4 -0
  30. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +2 -2
  31. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  32. package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
  33. package/dist/features/Operation/layouts/ModernLayout.vue2.js +86 -74
  34. package/dist/features/Operation/types/schemas.d.ts +3 -0
  35. package/dist/features/Operation/types/schemas.d.ts.map +1 -0
  36. package/dist/index.js +1 -1
  37. package/dist/style.css +1 -1
  38. package/package.json +8 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
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
+
3
19
  ## 1.29.3
4
20
 
5
21
  ### Patch Changes
package/README.md CHANGED
@@ -6,29 +6,10 @@
6
6
  [![License](https://img.shields.io/npm/l/%40scalar%2Fapi-reference)](https://www.npmjs.com/package/@scalar/api-reference)
7
7
  [![Discord](https://img.shields.io/discord/1135330207960678410?style=flat&color=5865F2)](https://discord.gg/scalar)
8
8
 
9
- Generate interactive API documentations from Swagger files. [Try our Demo](https://docs.scalar.com/swagger-editor)
9
+ Interactive API Reference from OpenAPI/Swagger Documents [Try our Demo](https://docs.scalar.com/swagger-editor)
10
10
 
11
11
  [![Screenshot of an API Reference](https://github.com/scalar/scalar/assets/6201407/d8beb5e1-bf64-4589-8cb0-992ba79215a8)](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
- <!-- Need a Custom Header? Check out this example: https://codepen.io/scalarorg/pen/VwOXqam -->
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
- <!-- Optional: You can set a full configuration object like this: -->
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
- document.getElementById('api-reference').dataset.configuration =
59
- JSON.stringify(configuration)
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>