Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
bed6fc4
format YAML
vasile Apr 9, 2026
70c0b4d
Migrate to angular app
vasile Apr 9, 2026
9ab2837
From angular bootstrap
vasile Apr 9, 2026
aa7d7a3
npm fresh install
vasile Apr 9, 2026
22d5804
.gitignore from angular
vasile Apr 9, 2026
d0343c2
Adds swagger favicon
vasile Apr 9, 2026
c2a7a5d
Adds angular bootstrap files
vasile Apr 9, 2026
cee65f2
adds bootstrap
vasile Apr 9, 2026
6bf188f
npm fresh install
vasile Apr 9, 2026
9d001a1
Adds bootstrap styles/scripts
vasile Apr 9, 2026
7d20d60
new location of spec files
vasile Apr 10, 2026
4649018
Adds API tokens and config
vasile Apr 10, 2026
69bce7e
Adds helpers
vasile Apr 10, 2026
50d136b
Simplified App component
vasile Apr 10, 2026
37d4cdd
Adds footer and header components
vasile Apr 10, 2026
9c8375b
Adds SwaggerUI dummy types
vasile Apr 10, 2026
1ecc529
Adds Swagger UI CSS
vasile Apr 10, 2026
494bdd1
Override Swagger UI css
vasile Apr 10, 2026
3d7f631
Replace config files for dev
vasile Apr 10, 2026
03bd2ee
Adds rest of packages
vasile Apr 10, 2026
b949167
npm fresh install
vasile Apr 10, 2026
dbfce41
Adds Index and Detail components
vasile Apr 10, 2026
cc31edb
Updates routes
vasile Apr 10, 2026
dfb5eb3
Updates .gitignore
vasile Apr 10, 2026
a7c0821
Adds placeholder types
vasile Apr 14, 2026
799f572
Adds IsoTimestamp. Today placeholders
vasile Apr 14, 2026
8f4eab6
Adds handle loaders
vasile Apr 14, 2026
6f227d6
Parse simple placeholders
vasile Apr 14, 2026
c512030
Adds code for parsing more complex placeholders
vasile Apr 14, 2026
b77fca9
Adds OJP fetch placeholders
vasile Apr 14, 2026
1bd4738
Registers and use OJP placeholders
vasile Apr 14, 2026
ab2f57d
Adds petty print XML formatter
vasile Apr 14, 2026
e4599c2
Name formatting
vasile Apr 14, 2026
0ee1bf5
Formatting
vasile Apr 14, 2026
bbe0528
Adds 200 responses
vasile Apr 14, 2026
3708a5f
Format yaml
vasile Apr 15, 2026
5782e56
Allow use of OJP 1 or 2
vasile Apr 15, 2026
60fb7b6
Cleanup
vasile Apr 15, 2026
a74654c
Adds OJP1 OK responses
vasile Apr 15, 2026
ad58c6a
Increase budget
vasile Apr 15, 2026
bb45074
Publish Angular app
vasile Apr 15, 2026
dd40549
Better name
vasile Apr 15, 2026
3248b4d
Updates title
vasile Apr 15, 2026
e40ef7e
Even better name
vasile Apr 15, 2026
ef93303
Fresh npm install
vasile Apr 15, 2026
22ebef2
Fix import
vasile Apr 15, 2026
7b71ddf
Updates deploy date
vasile Apr 15, 2026
e46439d
Use relative paths
vasile Apr 15, 2026
d912537
Space the footer
vasile Apr 15, 2026
9e47c5b
These are gone
vasile Apr 15, 2026
614d8b7
temp stop deploying on branch
vasile Apr 15, 2026
f029092
Updates README
vasile Apr 15, 2026
bd3db76
Removed local branch
vasile Apr 15, 2026
1553ec1
Suppress errors
vasile Apr 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single
ij_typescript_use_double_quotes = false

[*.md]
max_line_length = off
trim_trailing_whitespace = false
17 changes: 0 additions & 17 deletions .env

This file was deleted.

83 changes: 83 additions & 0 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Deploy Angular to GitHub Pages

on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm

- name: Install dependencies
run: npm ci

- name: Inject secrets
run: |
sed -i "s|PLACEHOLDER_REPLACE_TOKEN__formation|${{ secrets.API_KEY_FORMATION_SERVICE }}|g" \
src/app/config/api-tokens.ts
sed -i "s|PLACEHOLDER_REPLACE_TOKEN__ojp1|${{ secrets.API_KEY_OJP1 }}|g" \
src/app/config/api-tokens.ts
sed -i "s|PLACEHOLDER_REPLACE_TOKEN__ojp2|${{ secrets.API_KEY_OJP2 }}|g" \
src/app/config/api-tokens.ts
sed -i "s|PLACEHOLDER_REPLACE_TOKEN__ojp_fare|${{ secrets.API_KEY_OJPFARE }}|g" \
src/app/config/api-tokens.ts
sed -i "s|PLACEHOLDER_REPLACE_TOKEN__traffic_lights|${{ secrets.API_KEY_TRAFFIC_LIGHTS }}|g" \
src/app/config/api-tokens.ts

- name: Build
run: npm run build -- --configuration production --base-href=/api-explorer/

- name: Detect build output folder
run: |
APP_DIR=$(find dist -mindepth 1 -maxdepth 1 -type d | head -n 1)

if [ -d "$APP_DIR/browser" ]; then
TARGET_DIR="$APP_DIR/browser"
else
TARGET_DIR="$APP_DIR"
fi

echo "TARGET_DIR=$TARGET_DIR" >> "$GITHUB_ENV"
echo "Using build output: $TARGET_DIR"

- name: Copy index.html to 404.html for Angular routing
run: cp "$TARGET_DIR/index.html" "$TARGET_DIR/404.html"

- name: Disable Jekyll
run: touch "$TARGET_DIR/.nojekyll"

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ env.TARGET_DIR }}

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
67 changes: 0 additions & 67 deletions .github/workflows/publish-swagger.yml

This file was deleted.

50 changes: 47 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,48 @@
node_modules
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.

.env.local
dist/
# Compiled output
/dist
/tmp
/out-tsc
/bazel-out

# Node
/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/mcp.json
.history/*

# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings
__screenshots__/

# System files
.DS_Store
Thumbs.db

# Custom below
.vscode
*.local.ts
12 changes: 12 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"printWidth": 100,
"singleQuote": true,
"overrides": [
{
"files": "*.html",
"options": {
"parser": "angular"
}
}
]
}
65 changes: 17 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,69 +4,38 @@ This repo allows to browse the OpenAPI specs for [opentransportdata.swiss](https

URL: https://opentdatach.github.io/api-explorer/

## Local Preview
## Local Development

```bash
$ npm install

# generates dist/ from the templates + config
$ npm run build
# duplicate local API credential file
$ cp ./src/app/config/api-tokens.ts ./src/app/config/api-tokens.local.ts

# runs at http://localhost:8080
$ npm run serve
```

## Adds a new API

- get the token (API key) for the new service - https://api-manager.opentransportdata.swiss/

- create a new secret in the repo https://github.com/openTdataCH/api-explorer/settings/secrets/actions

- add the key name as a placeholder the `.env` file and with real value in the `.env.local` file (this is ignored by Git)
```
# .env (commited, in the repo)
API_KEY_NEWAPI=PLACEHOLDER

# .env.local (file excluded from Git)
API_KEY_NEWAPI=eyJvcmciOiI2NDA....
```
# edit api-tokens.local.ts
# fill with tokens obtained from https://api-manager.opentransportdata.swiss/

- add the key to `Build index.html landing page / API folders` task in [.github/workflows/publish-swagger.yml](./.github/workflows/publish-swagger.yml)
# develop on localhost
$ ng serve

# open http://localhost:4200
```
- name: Build index.html landing page / API folders
env:
# from repo secrets https://github.com/openTdataCH/api-explorer/settings/secrets/actions
... more keys

API_KEY_NEWAPI: ${{ secrets.API_KEY_NEWAPI }}
run: |
node scripts/render-openapi.mjs
```

- add a new entry in [apis.yaml](./apis.yaml). the id used will be used in the permalink URL, i.e. for `ojp1.0` the URL + path is https://opentdatach.github.io/api-explorer/ojp1.0/

```
apis:
- id: new_service
title: New Service
map_secrets:
API_KEY: API_KEY_NEWAPI
...
```

- duplicate any of the folders in `openapi/` folder as `openapi/new_service`.

- edit the OpenAPI specs in `openapi/new_service/openapi.template.yaml` file
## Adds a new API

- run `npm build` and inspect the `dist` folder
- get the token (API key) for the new service - https://api-manager.opentransportdata.swiss/
- update config in
- [./src/app/config/api-config.ts](./src/app/config/api-config.ts)
- [./src/app/config/api-tokens.local.ts](./src/app/config/api-tokens.local.ts)
- [./src/app/config/api-tokens.ts](./src/app/config/api-tokens.ts)
- duplicate and edit one of the existing OpenAPI specs - [./public/openapi](./public/openapi)

## Deployment

A GitHub Actions workflow (under [.github/workflows/publish-swagger.yml](./.github/workflows/publish-swagger.yml)) builds the site and publishes it to GitHub Pages on push to the default branch
A GitHub Actions workflow (under [.github/workflows/deploy-pages.yml](./.github/workflows/deploy-pages.yml)) builds the site and publishes it to GitHub Pages on push to the default branch

## License

The project is released under a [MIT license](./LICENSE.txt).

Copyright (c) 2025 Open Data Platform Mobility Switzerland - [opentransportdata.swiss](https://opentransportdata.swiss/en/).
Copyright (c) 2025 - 2026 Open Data Platform Mobility Switzerland - [opentransportdata.swiss](https://opentransportdata.swiss/en/).
Loading