Skip to content

Commit edb41dc

Browse files
committed
fixing url for incidentRestAPI .html
1 parent 032340b commit edb41dc

File tree

1 file changed

+69
-319
lines changed

1 file changed

+69
-319
lines changed

dispoAPI/DispoAPI.yml

+69-319
Original file line numberDiff line numberDiff line change
@@ -1,327 +1,77 @@
1-
openapi: '3.0.2'
2-
info:
3-
title: DispoAPI
4-
description: handles inventory changes in MyIT cmdb for DispoTool.
5-
version: '0.0.1'
1+
name: Generate html from yml docs and publish to pages
62

7-
servers:
8-
- url: https://myit-dev.post.ch/api/x_ssagd_dispoapi/dispoapi
9-
description: development server
3+
on:
4+
push:
5+
branches:
6+
- main
107

11-
security:
12-
- BasicAuth: []
13-
14-
paths:
15-
/switchDevice:
16-
patch:
17-
summary: Switches one device for another in the cmdb, including any children the old device might have had.
18-
description: tbd
19-
requestBody:
20-
content:
21-
application/json:
22-
schema:
23-
type: object
24-
properties:
25-
inventoryNumber_old:
26-
description: "The asset tag of the old device."
27-
type: string
28-
inventoryNumber_new:
29-
description: "The asset tag of the new device."
30-
type: string
31-
storage_location:
32-
description: "The sys-id of the storage location of the old device."
33-
type: string
34-
technician:
35-
description: "The technician performing the action. This string will appear in the activity stream."
36-
type: string
37-
comment:
38-
description: "A comment composed by the technician that will appear in the activity stream."
39-
type: string
40-
required:
41-
- inventoryNumber_old
42-
- inventoryNumber_new
43-
- storage_location
44-
- technician
45-
- comment
8+
jobs:
9+
generate_docs:
10+
name: Generate HTML Docs
11+
runs-on: ubuntu-latest
4612

47-
responses:
48-
'200':
49-
description: OK
50-
content:
51-
application/json:
52-
schema:
53-
type: object
54-
properties:
55-
message:
56-
type: string
57-
example: "Device 23282978 was switched for 23271091 successfully."
58-
'400':
59-
description: bad request
60-
content:
61-
application/json:
62-
schema:
63-
type: object
64-
properties:
65-
name:
66-
type: string
67-
example: "MyItRestException"
68-
message:
69-
type: string
70-
example: "inventoryNumber_old is missing or null in the request body."
71-
status:
72-
type: integer
73-
example: 400
74-
'403':
75-
description: forbidden
76-
content:
77-
application/json:
78-
schema:
79-
type: object
80-
properties:
81-
clazz:
82-
type: string
83-
example: "IllegalAccessException"
84-
status:
85-
type: integer
86-
example: 403
87-
message:
88-
type: string
89-
example: "You are not authorized to access this API"
90-
'500':
91-
description: Internal Server Error
92-
content:
93-
application/json:
94-
schema:
95-
type: object
96-
properties:
97-
clazz:
98-
type: string
99-
example: "MyItRestException"
100-
status:
101-
type: integer
102-
example: 500
103-
message:
104-
type: string
105-
example: "something went wrong while writing data to the new device"
13+
permissions:
14+
contents: write
10615

107-
/installDevice:
108-
patch:
109-
summary: Installs a device in the cmdb
110-
description: tbd
111-
requestBody:
112-
content:
113-
application/json:
114-
schema:
115-
type: object
116-
properties:
117-
inventoryNumber:
118-
description: "The asset tag of the device."
119-
type: string
120-
location:
121-
description: "The location of the device."
122-
type: string
123-
technician:
124-
description: "The technician performing the action. This string will appear in the activity stream."
125-
type: string
126-
comment:
127-
description: "A comment composed by the technician that will appear in the activity stream."
128-
type: string
129-
assigned_to:
130-
description: "The sys-id of the user of the device."
131-
type: string
132-
cost_center:
133-
description: "The sys-id of the cost-center of the device."
134-
type: string
135-
children:
136-
description: "Any children to install alongside the device containing the sys-id of the child as well as the name of the relation."
137-
type: array
138-
example: [
139-
{
140-
"child" : "0007047387bb39d06dc863540cbb0000",
141-
"relation" : "Connects to::Connected by"
142-
},
143-
{
144-
"child" : "0007047387bb39d06dc863540cbb0001",
145-
"relation" : "Connects to::Connected by"
146-
}
147-
]
148-
parents:
149-
description: "Any parents the device has containing the sys-id of the parent as well as the name of the relation."
150-
type: array
151-
example: [
152-
{
153-
"parent" : "0007047387bb39d06dc863540cbb0000",
154-
"relation" : "Connects to::Connected by"
155-
}
156-
]
157-
required:
158-
- inventoryNumber
159-
- location
160-
- technician
161-
- comment
162-
responses:
163-
'200':
164-
description: OK
165-
content:
166-
application/json:
167-
schema:
168-
type: object
169-
properties:
170-
message:
171-
type: string
172-
example: "Device 23282978 was installed successfully."
173-
'400':
174-
description: bad request
175-
content:
176-
application/json:
177-
schema:
178-
type: object
179-
properties:
180-
name:
181-
type: string
182-
example: "MyItRestException"
183-
message:
184-
type: string
185-
example: "inventoryNumber is missing or null in the request body."
186-
status:
187-
type: integer
188-
example: 400
189-
'403':
190-
description: forbidden
191-
content:
192-
application/json:
193-
schema:
194-
type: object
195-
properties:
196-
clazz:
197-
type: string
198-
example: "IllegalAccessException"
199-
status:
200-
type: integer
201-
example: 403
202-
message:
203-
type: string
204-
example: "You are not authorized to access this API"
205-
'500':
206-
description: Internal Server Error
207-
content:
208-
application/json:
209-
schema:
210-
type: object
211-
properties:
212-
clazz:
213-
type: string
214-
example: "MyItRestException"
215-
status:
216-
type: integer
217-
example: 500
218-
message:
219-
type: string
220-
example: "something went wrong writing data to the new device"
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/[email protected]
22119

222-
/uninstallDevice:
223-
patch:
224-
summary: Uninstalls a device in the cmdb including any children passed in the request.
225-
description: tbd
226-
requestBody:
227-
content:
228-
application/json:
229-
schema:
230-
type: object
231-
properties:
232-
inventoryNumber:
233-
description: "The asset tag of the device."
234-
type: string
235-
storage_location:
236-
description: "The sys-id of the storage location of the device."
237-
type: string
238-
technician:
239-
description: "The technician performing the action. This string will appear in the activity stream."
240-
type: string
241-
comment:
242-
description: "A comment composed by the technician that will appear in the activity stream."
243-
type: string
244-
children:
245-
description: "The list of sys-id's of children to uninstall alongside the parent-device. This has to exactly match the existing children in the cmdb."
246-
type: array
247-
example: [
248-
{
249-
"child" : "0007047387bb39d06dc863540cbb0000"
250-
},
251-
{
252-
"child" : "0007047387bb39d06dc863540cbb0001"
253-
}
254-
]
20+
- name: Check for .yml files
21+
run: |
22+
if ls ./*.yml dispoAPI/*.yml 1> /dev/null 2>&1; then
23+
echo "YAML files found."
24+
else
25+
echo "No YAML files found. Exiting."
26+
exit 1
27+
fi
25528
256-
required:
257-
- inventoryNumber
258-
- storage_location
259-
- technician
260-
- comment
261-
262-
responses:
263-
'200':
264-
description: OK
265-
content:
266-
application/json:
267-
schema:
268-
type: object
269-
properties:
270-
message:
271-
type: string
272-
example: "Device 23282978 was uninstalled successfully."
273-
'400':
274-
description: bad request
275-
content:
276-
application/json:
277-
schema:
278-
type: object
279-
properties:
280-
name:
281-
type: string
282-
example: "MyItRestException"
283-
message:
284-
type: string
285-
example: "inventoryNumber is missing or null in the request body."
286-
status:
287-
type: integer
288-
example: 400
289-
'403':
290-
description: forbidden
291-
content:
292-
application/json:
293-
schema:
294-
type: object
295-
properties:
296-
clazz:
297-
type: string
298-
example: "IllegalAccessException"
299-
status:
300-
type: integer
301-
example: 403
302-
message:
303-
type: string
304-
example: "You are not authorized to access this API"
305-
'500':
306-
description: Internal Server Error
307-
content:
308-
application/json:
309-
schema:
310-
type: object
311-
properties:
312-
clazz:
313-
type: string
314-
example: "MyItRestException"
315-
status:
316-
type: integer
317-
example: 500
318-
message:
319-
type: string
320-
example: "something went wrong writing data to the device"
29+
- name: Install Node.js
30+
uses: actions/[email protected]
32131

322-
components:
323-
securitySchemes:
324-
BasicAuth:
325-
type: http
326-
scheme: basic
32+
- name: Install Redocly CLI
33+
run: npm install -g @redocly/cli
32734

35+
- name: Generate HTML files
36+
run: |
37+
# Generate HTML for YAML files in root directory
38+
for file in ./*.yml; do
39+
if [ -f "$file" ]; then
40+
output_html="${file%.*}.html"
41+
redocly build-docs -o "$output_html" "$file"
42+
fi
43+
done
44+
45+
# Generate HTML for YAML files in dispoAPI directory
46+
for file in dispoAPI/*.yml; do
47+
if [ -f "$file" ]; then
48+
output_html="dispoAPI/index.html"
49+
redocly build-docs -o "$output_html" "$file"
50+
fi
51+
done
52+
53+
- name: Add noIndex Meta Tag
54+
run: |
55+
for file in ./*.html dispoAPI/*.html; do
56+
if [ -f "$file" ]; then
57+
echo "Found HTML file: $file"
58+
if sed -i '/<head>/a <meta name="robots" content="noindex">' "$file"; then
59+
echo "Added meta tag to $file successfully."
60+
else
61+
echo "Failed to add meta tag to $file."
62+
fi
63+
fi
64+
done
65+
shell: bash
66+
67+
- name: Set up Git
68+
run: |
69+
git config --global user.email "[email protected]"
70+
git config --global user.name "GitHub Actions"
71+
72+
- name: Deploy to GitHub Pages
73+
uses: JamesIves/[email protected]
74+
with:
75+
token: ${{ secrets.GITHUB_TOKEN }}
76+
branch: gh-pages
77+
folder: . # Root folder where HTML files are located

0 commit comments

Comments
 (0)