Skip to content

Commit a3ea573

Browse files
Merge pull request #41 from ayushshrivastv/API-documentation-hosting
API documentation hosting issues to prevent 404 errors
2 parents d1687e4 + 9e5414e commit a3ea573

File tree

60 files changed

+624
-17
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+624
-17
lines changed

.github/workflows/jekyll-gh-pages.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
# This workflow is currently disabled and has been renamed to jekyll-gh-pages.yml.disabled
12
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
23
name: Deploy Jekyll with GitHub Pages dependencies preinstalled
34

45
on:
56
# Runs on pushes targeting the default branch
67
push:
7-
branches: ["main"]
8+
branches: ["disabled-branch"]
89

910
# Allows you to run this workflow manually from the Actions tab
1011
workflow_dispatch:
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This workflow is currently disabled
2+
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
3+
name: Deploy Jekyll with GitHub Pages dependencies preinstalled
4+
5+
on:
6+
# Runs on pushes targeting the default branch
7+
push:
8+
branches: ["disabled-branch"]
9+
10+
# Allows you to run this workflow manually from the Actions tab
11+
workflow_dispatch:
12+
13+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14+
permissions:
15+
contents: read
16+
pages: write
17+
id-token: write
18+
19+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
20+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
21+
concurrency:
22+
group: "pages"
23+
cancel-in-progress: false
24+
25+
jobs:
26+
# Build job
27+
build:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
- name: Setup Pages
33+
uses: actions/configure-pages@v5
34+
- name: Build with Jekyll
35+
uses: actions/jekyll-build-pages@v1
36+
with:
37+
source: ./
38+
destination: ./_site
39+
- name: Upload artifact
40+
uses: actions/upload-pages-artifact@v3
41+
42+
# Deployment job
43+
deploy:
44+
environment:
45+
name: github-pages
46+
url: ${{ steps.deployment.outputs.page_url }}
47+
runs-on: ubuntu-latest
48+
needs: build
49+
steps:
50+
- name: Deploy to GitHub Pages
51+
id: deployment
52+
uses: actions/deploy-pages@v4

.github/workflows/pages.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
jobs:
18-
deploy:
18+
build-and-deploy:
1919
environment:
2020
name: github-pages
2121
url: ${{ steps.deployment.outputs.page_url }}
@@ -24,6 +24,18 @@ jobs:
2424
- name: Checkout
2525
uses: actions/checkout@v4
2626

27+
- name: Setup Swift
28+
uses: swift-actions/setup-swift@v1
29+
with:
30+
swift-version: "5.9"
31+
32+
- name: Build DocC documentation
33+
run: |
34+
swift build
35+
chmod +x ./scripts/build-docs.sh
36+
# The build script now handles path fixing automatically
37+
./scripts/build-docs.sh
38+
2739
- name: Setup Pages
2840
uses: actions/configure-pages@v5
2941

README.md

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ OpenAPI is the industry standard for documenting HTTP services, but Swift develo
1313
The project is organized into several modules:
1414

1515
- `Sources/Core` - Core functionality and data models
16-
- `Sources/CLI` - Command-line interface
16+
- `Sources/CLI` - Command-line interface
1717
- `Sources/OpenAPItoSymbolGraph` - Main implementation with submodules:
1818
- `Mapping` - Mappers between OpenAPI and SymbolGraph
1919
- `Utils/DocC` - DocC integration utilities
@@ -62,32 +62,44 @@ The tool has also been tested with the standard Swagger Pet Store OpenAPI defini
6262
swift run openapi-to-symbolgraph Examples/petstore.yaml --output-path petstore.symbolgraph.json
6363
```
6464

65-
2. Create a DocC documentation catalog (see `API.docc` as an example)
65+
2. Generate the documentation using our helper script:
6666

67-
3. Generate the documentation:
67+
```bash
68+
./scripts/build-docs.sh
69+
```
70+
71+
Or manually with DocC:
6872

6973
```bash
7074
xcrun docc convert YourAPI.docc --fallback-display-name YourAPI --fallback-bundle-identifier com.example.YourAPI --fallback-bundle-version 1.0.0 --additional-symbol-graph-dir ./ --output-path ./docs
7175
```
7276

7377
## Viewing the Documentation
7478

75-
The `docs/` directory in this repository contains the pre-generated DocC documentation website output for the **Swagger Pet Store API**, which was built using the `petstore.symbolgraph.json` generated by this tool and the `API.docc` catalog.
79+
The `docs/` directory in this repository contains the pre-generated DocC documentation website output for the **Swift Package Registry API**, which was built using the `registry.symbolgraph.json` generated by this tool and the `RegistryAPI.docc` catalog.
7680

7781
### Documentation
7882

7983
The latest documentation is automatically deployed to GitHub Pages and can be viewed at:
8084

81-
[https://ayushshrivastv.github.io/OpenAPI-integration-with-DocC/](https://ayushshrivastv.github.io/OpenAPI-integration-with-DocC/)
85+
[https://ayushshrivastv.github.io/OpenAPI-Integration-with-DocC/](https://ayushshrivastv.github.io/OpenAPI-Integration-with-DocC/)
8286

8387
### Local Documentation Server
8488

8589
You can serve the documentation locally using one of these methods:
8690

87-
#### Using the helper script:
91+
#### Using the local preview script (recommended):
92+
93+
```bash
94+
./scripts/local-preview.sh
95+
```
96+
97+
This script serves the documentation directory and opens it in your browser. You will be automatically redirected to the API documentation.
98+
99+
#### Using the server script:
88100

89101
```bash
90-
./serve-docs.sh
102+
./scripts/serve-docs.sh
91103
```
92104

93105
#### Using Python 3 directly:
@@ -114,9 +126,10 @@ Check out the `DocsExample` directory for a working example of a REST API docume
114126
This repository is configured to automatically deploy documentation to GitHub Pages whenever changes are pushed to the main branch. The deployment process:
115127

116128
1. Uses the GitHub Actions workflow defined in `.github/workflows/pages.yml`
117-
2. Takes the contents of the `docs` directory
118-
3. Deploys them to GitHub Pages
119-
4. Makes the documentation available at the URL: [https://ayushshrivastv.github.io/OpenAPI-integration-with-DocC/](https://ayushshrivastv.github.io/OpenAPI-integration-with-DocC/)
129+
2. Builds the documentation from the OpenAPI specification
130+
3. Takes the contents of the `docs` directory
131+
4. Deploys them to GitHub Pages
132+
5. Makes the documentation available at the URL: [https://ayushshrivastv.github.io/OpenAPI-Integration-with-DocC/](https://ayushshrivastv.github.io/OpenAPI-Integration-with-DocC/)
120133

121134
## Contributing
122135

docs-local/OpenAPI-Integration-with-DocC/css/866.2d08a543.css

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs-local/OpenAPI-Integration-with-DocC/css/989.4f123103.css

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs-local/OpenAPI-Integration-with-DocC/css/documentation-topic.da0b1931.css

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs-local/OpenAPI-Integration-with-DocC/css/index.3a335429.css

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs-local/OpenAPI-Integration-with-DocC/css/topic.4be8f56d.css

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs-local/OpenAPI-Integration-with-DocC/css/tutorials-overview.adb17623.css

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)