@kong-ui-public/spec-renderer 0.3.2 → 0.4.2

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/README.md CHANGED
@@ -1,27 +1,29 @@
1
1
  # @kong-ui-public/spec-renderer
2
2
 
3
- A Kong UI component for displaying API specs
3
+ A Kong UI component for displaying and filtering API specs
4
4
 
5
5
  - [Features](#features)
6
6
  - [Requirements](#requirements)
7
7
  - [Usage](#usage)
8
8
  - [Install](#install)
9
9
  - [Register](#register)
10
- - [Props](#props)
11
- - [`document`](#document)
12
- - [`url`](#url)
13
- - [`hasSidebar`](#hassidebar)
14
- - [`relativeSidebar`](#relativesidebar)
15
- - [`essentialsOnly`](#essentialsonly)
10
+ - [Included Components](#included-components)
11
+ - [`SpecRenderer`](#specrenderer)
12
+ - [`SpecOperationsList`](#specoperationslist)
13
+ - [`SpecDetails`](#specdetails)
16
14
 
17
15
  ## Features
18
16
 
19
- - Render `.yaml` and `.json` OAS specs
20
- - Customize display of API specs in the UI
17
+ - Render spec with optional side nav and filtering
21
18
 
22
19
  ## Requirements
23
20
 
24
21
  - `vue` must be initialized in the host application
22
+ - `@kong/kongponents` must be available as a `dependency` in the host application, along with the package's style imports. [See here for instructions on installing Kongponents](https://kongponents.konghq.com/#globally-install-all-kongponents). Specifically, the following Kongponents must be available:
23
+ - `KBadge`
24
+ - `KCollapse`
25
+ - `KIcon`
26
+ - `KInput`
25
27
 
26
28
  ## Usage
27
29
 
@@ -35,71 +37,36 @@ yarn add @kong-ui-public/spec-renderer
35
37
 
36
38
  ### Register
37
39
 
38
- You can register `portal-spec-renderer` globally or locally.
39
-
40
- ```typescript
41
- // Global registration
42
- import { createApp } from 'vue'
43
- import SpecRenderer from '@kong-ui-public/spec-renderer'
44
- import '@kong-ui-public/spec-renderer/dist/style.css'
45
-
46
- const app = createApp(App)
47
-
48
- app.use(SpecRenderer)
49
-
50
- ```
40
+ You can register `spec-renderer` locally. In order to support proper tree-shaking in the host application, please only import and register the components in the page/component where they are being utilized.
51
41
 
52
42
  ```html
53
43
  <!-- Local registration -->
54
44
  <template>
55
45
  <SpecRenderer />
46
+ <SpecOperationsList />
47
+ <SpecDetails />
56
48
  </template>
57
49
 
58
50
  <script setup lang="ts">
59
- import SpecRenderer from '@kong-ui-public/spec-renderer'
51
+ // Only import the components you need
52
+ import { SpecRenderer, SpecOperationsList, SpecDetails } from '@kong-ui-public/spec-renderer'
53
+ // CSS import required for ANY of the components
60
54
  import '@kong-ui-public/spec-renderer/dist/style.css'
61
55
  </script>
62
56
  ```
63
57
 
64
- ## Props
65
-
66
- ### `document`
67
-
68
- - type: `String|Object`
69
- - required: `false`
70
- - default: `null`
71
-
72
- Specification object or string. Required if `url` property is not set.
73
-
74
- ### `url`
75
-
76
- - type: `String`
77
- - required: `false`
78
- - default: `''`
79
-
80
- URL of the specification file. Required if `document` property is not set.
81
-
82
- ### `hasSidebar`
83
-
84
- - type: `Boolean`
85
- - required: `false`
86
- - default: `true`
58
+ ## Included Components
87
59
 
88
- Whether or not the SwaggerUI navigation sidebar is enabled.
60
+ The `SpecRenderer` component is a combination of two subcompoents, `SpecOperationsList` and `SpecDetails` which are exported for individual use if desired.
89
61
 
90
- ### `relativeSidebar`
62
+ ### `SpecRenderer`
91
63
 
92
- - type: `Boolean`
93
- - required: `false`
94
- - default: `false`
64
+ See the component [documentation](docs/spec-renderer).
95
65
 
96
- Position the sidebar relatively instead of fixed.
97
- Both `hasSidebar` and `essentialsOnly` must be `true` for the positioning to be correct since we aren't predicting the height of the info block.
66
+ ### `SpecOperationsList`
98
67
 
99
- ### `essentialsOnly`
68
+ See the component [documentation](docs/spec-operations-list).
100
69
 
101
- - type: `Boolean`
102
- - required: `false`
103
- - default: `false`
70
+ ### `SpecDetails`
104
71
 
105
- If enabled, only display the spec `paths` section; general information, schemes, models, actions (Authorize & Try it out), etc. are hidden.
72
+ See the component [documentation](docs/spec-details).