Skip to content

Commit 86a9bc0

Browse files
committed
overlay: demo of applying an overlay to add x-topics
1 parent 5fadc50 commit 86a9bc0

5 files changed

Lines changed: 52 additions & 5 deletions

File tree

.github/scripts/deploy-all.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ npm install -g bump-cli
1111
# For each directory in the hubs/ directory
1212
for hub in hubs/*/; do
1313
for api in "${hub}"*-source.{yml,yaml,json}; do
14+
[ -f "${api}" ] || continue
1415
# Extract the Hub name from directory structure
1516
hubName="${hub%/*}"
1617
hubName="${hubName#*/}"
@@ -21,6 +22,15 @@ for hub in hubs/*/; do
2122
apiName="${apiName#*/}"
2223
apiName="${apiName#*/}"
2324

25+
# Apply any available overlays from filename
26+
# `<api_name>-overlay*.yaml`
27+
for overlay in "${hub}"/"${apiName}"-overlay*.{yml,yaml}; do
28+
[ -f "${overlay}" ] || continue
29+
# Overide current api definition file with overlayed
30+
# definition
31+
yes | npx bump-cli overlay "${api}" "${overlay}" -o "${api}"
32+
done
33+
2434
# Create documentation <apiName> from the api definition file
2535
tokenKey="${hubName//-/_}_BUMP_TOKEN"
2636
tokenKey="${tokenKey^^}"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#    
2+
3+
```
4+
curl \
5+
-X GET https://bump.sh/api/v1/versions/1 \
6+
-H "Authorization: Token $ACCESS_TOKEN"
7+
```
8+
9+
#    
10+
11+
```
12+
curl \
13+
-X GET https://bump.sh/api/v1/versions/1 \
14+
-u ":$ACCESS_TOKEN"
15+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Http token authentication
2+
3+
> success
4+
> This is the preferred authentication method for restricted access API endpoints
5+
6+
Use the token from your documentation settings in the HTTP token authorization header.
7+
8+
# Basic authentication
9+
10+
*(Deprecated)* Use the token from your documentation settings as the username of the basic auth, with no password.
11+

hubs/my-train-company/trainbook-openapi-source.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ security:
3131
- OAuth2:
3232
- read
3333

34-
x-topics:
35-
- title: Getting started
36-
content:
37-
$ref: ./docs/getting-started.md
38-
3934
tags:
4035
- name: Stations
4136
description: |
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
overlay: 1.0.0
2+
info:
3+
title: Add all the x-topics files as references
4+
version: 0.0.1
5+
actions:
6+
- target: '$'
7+
update:
8+
x-topics:
9+
- title: Getting started
10+
content:
11+
$ref: ./docs/getting-started.md
12+
- title: Authentication
13+
content:
14+
$ref: ./docs/authentication/index.md
15+
example:
16+
$ref: ./docs/authentication/example.md

0 commit comments

Comments
 (0)