Skip to content

Commit

Permalink
Merge pull request #250 from aloccid-iata/master
Browse files Browse the repository at this point in the history
API Documentation separation
  • Loading branch information
lambertciata authored Jul 16, 2024
2 parents abe083f + 20653b5 commit 8dd1e6f
Show file tree
Hide file tree
Showing 103 changed files with 321 additions and 206 deletions.
31 changes: 18 additions & 13 deletions .github/workflows/docs_builder.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ONE Record Github pages deployer
name: ONE Record Github Pages deployer (development)
on:
push:
branches:
Expand All @@ -10,17 +10,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
continue-on-error: true
- uses: actions/setup-python@v4
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v3
fetch-depth: 0
- uses: actions/setup-python@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs mkdocs-material
- run: make deployGH
working-directory: ./working_draft/API/
python-version: 3.10.6
- name: Install Dependencies
run: |
pip install mkdocs-material
pip install mike
- name: Setup Docs Deploy
run: |
git config --global user.name "IATA-Cargo"
git config --global user.email "[email protected]"
- name: Build Docs Website
run: |
make copy-assets
mike deploy --push development
working-directory: ./Documentation_website

27 changes: 27 additions & 0 deletions .github/workflows/docs_eraser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Github Pages Eraser
on:
workflow_dispatch:
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.10.6
- name: Install Dependencies
run: |
pip install mkdocs-material
pip install mike
- name: Setup Docs Deploy
run: |
git config --global user.name "IATA-Cargo"
git config --global user.email "[email protected]"
- name: Build Docs Website
run: |
mike delete --push --all
working-directory: ./Documentation_website
31 changes: 31 additions & 0 deletions .github/workflows/docs_publisher.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: ONE Record new release publisher
on:
release:
types: [published]

permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.10.6
- name: Install Dependencies
run: |
pip install mkdocs-material
pip install mike
- name: Setup Docs Deploy
run: |
git config --global user.name "Docs Deploy"
git config --global user.email "[email protected]"
- name: Build Docs Website
run: |
make copy-assets
mike deploy --push --update-aliases ${{ github.event.release.tag_name }} stable
mike set-default --push stable
working-directory: ./Documentation_website
File renamed without changes.
51 changes: 51 additions & 0 deletions Documentation_website/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
SITE_DIR := $(CURDIR)/site
VERSION := 2.0.0-dev

install:
pip install pip --upgrade
pip install -r requirements.txt

upgrade:
pip install pip --upgrade
pip install -r requirements.txt --upgrade

copy-assets:
rm -rf docs/API-Security/changelog.md; cp ../working_draft/API/CHANGELOG.md docs/API-Security/changelog.md
rm -rf docs/API-Security/license.md; cp ../LICENSE docs/API-Security/license.md
rm -rf docs/API-Security/assets/ONE-Record-API-Ontology.ttl; cp ../working_draft/API/ONE-Record-API-Ontology.ttl docs/API-Security/assets/ONE-Record-API-Ontology.ttl
rm -rf docs/API-Security/assets/ONE-Record-API-Class-Diagram.md; cp ../working_draft/API/ONE-Record-API-Class-Diagram.md docs/API-Security/assets/ONE-Record-API-Class-Diagram.md
rm -rf docs/API-Security/assets/ONE-Record-API-OpenAPI.yaml; cp ../working_draft/API/ONE-Record-API-OpenAPI.yaml docs/API-Security/assets/ONE-Record-API-OpenAPI.yaml
rm -rf docs/API-Security/assets/ONE-Record-API-Ontology.csv; cp ../working_draft/API/ONE-Record-API-Ontology.csv docs/API-Security/assets/ONE-Record-API-Ontology.csv
rm -rf docs/API-Security/assets/ONE-Record-API-Collections.postman_collection; cp ../working_draft/API/ONE-Record-API-Collections.postman_collection docs/API-Security/assets/ONE-Record-API-Collections.postman_collection

serve:
$(MAKE) copy-assets
mkdocs serve

build:
$(MAKE) copy-assets
mkdocs build
mkdir -p $(SITE_DIR)/ns/api/$(VERSION)
echo "<!DOCTYPE html> <meta charset=\"utf-8\"> <title>Redirecting to versioned ontology</title> <meta http-equiv=\"refresh\" content=\"0; URL=./2.0.0-dev\"> <link rel=\"canonical\" href=\"2.0.0-dev\">" > $(SITE_DIR)/ns/api/index.html
python -m pylode ONE-Record-API-Ontology.ttl -o $(SITE_DIR)/ns/api/$(VERSION)/index.html


deployGH:
$(MAKE) copy-assets
mkdocs gh-deploy --ignore-version --no-history

clean:
rm -rf $(SITE_DIR)

ghp-deploy:
ghp-import -m "updating docs" --no-history -p site

mike-deploy:
$(MAKE) copy-assets
mike deploy --push development

mike-release:
$(MAKE) copy-assets
mike deploy --push --update-aliases ${{ github.event.release.tag_name }} latest

.PHONY: install upgrade copy-assets serve build deployGH clean ghp-deploy
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ POST /access-delegations HTTP/1.1
Content-Type: application/ld+json; version=2.0.0-dev
Accept: application/ld+json; version=2.0.0-dev
--8<-- "examples/AccessDelegation_example1.json"
--8<-- "API-Security/examples/AccessDelegation_example1.json"
```
_([examples/AccessDelegation_example1.json](examples/AccessDelegation_example1.json))_
_([AccessDelegation_example1.json](./examples/AccessDelegation_example1.json))_

Response:
```bash
Expand All @@ -141,9 +141,9 @@ POST /access-delegations HTTP/1.1
Content-Type: application/ld+json; version=2.0.0-dev
Accept: application/ld+json; version=2.0.0-dev
--8<-- "examples/AccessDelegation_example2.json"
--8<-- "API-Security/examples/AccessDelegation_example2.json"
```
_([examples/AccessDelegation_example2.json](examples/AccessDelegation_example2.json))_
_([AccessDelegation_example2.json](./examples/AccessDelegation_example2.json))_

Response:
```bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ Location: https://1r.example.com/action-requests/599fea49-7287-42af-b441-1fa618d
Type: https://onerecord.iata.org/ns/api#SubscriptionRequest
Last-Modified: Tue, 21 Feb 2023 07:28:00 GMT

--8<-- "examples/SubscriptionRequest_example2.json"
--8<-- "API-Security/examples/SubscriptionRequest_example2.json"
```
_([examples/SubscriptionRequest_example2.json](examples/SubscriptionRequest_example2.json))_
_([SubscriptionRequest_example2.json](./examples/SubscriptionRequest_example2.json))_

# Update an Action Request

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -175,19 +175,19 @@ Therefore, the same `Sensor` object can be formatted as extended (see example 1)

**Example 1:**

```json title="examples/Sensor.expanded.json"
--8<-- "examples/Sensor.expanded.json"
```json title="Sensor.expanded.json"
--8<-- "API-Security/examples/Sensor.expanded.json"
```

(see [examples/Sensor.expanded.json](examples/Sensor.expanded.json))
(see [Sensor.expanded.json](./examples/Sensor.expanded.json))

**Example 2:**

```json title="examples/Sensor.compacted.json"
--8<-- "examples/Sensor.compacted.json"
```json title="Sensor.compacted.json"
--8<-- "API-Security/examples/Sensor.compacted.json"
```

(see [examples/Sensor.compacted.json](examples/Sensor.compacted.json))
(see [Sensor.compacted.json](./examples/Sensor.compacted.json))

There are more forms that are equal to the example above. Copy and paste the first example on the [JSON-LD Playground](https://json-ld.org/playground/) to see this different forms.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,9 @@ HTTP/1.1 403 Forbidden
Content-Language: en-US
Content-Type: application/ld+json

--8<-- "examples/Error_403.json"
--8<-- "API-Security/examples/Error_403.json"
```
_([examples/Error_403.json](examples/Error_403.json))_
_([Error_403.json](./examples/Error_403.json))_

## Asynchronous Error Handling

Expand Down Expand Up @@ -395,9 +395,9 @@ HTTP/1.1 404 Not Found
Content-Language: de-DE
Content-Type: application/ld+json

--8<-- "examples/Error_404.de-DE.json"
--8<-- "API-Security/examples/Error_404.de-DE.json"
```
_([examples/Error_404.de-DE.json](examples/Error_404.de-DE.json))_
_([Error_404.de-DE.json](./examples/Error_404.de-DE.json))_

# Caching

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The following HTTP header parameters MUST be present in the request:

The HTTP request body must contain a valid [LogisticsEvent](https://onerecord.iata.org/ns/cargo#LogisticsEvent) in the format as specified by the Content-Type in the header.

The LogisticsEvent is a data class of the [ONE Record cargo ontology](https://onerecord.iata.org/ns/cargo/3.0.0).
The LogisticsEvent is a data class of the [ONE Record cargo ontology](https://onerecord.iata.org/ns/cargo).
The properties and relationships to other data classes are visualized in the following class diagram.

```mermaid
Expand Down Expand Up @@ -135,10 +135,10 @@ Host: 1r.example.com
Content-Type: application/ld+json; version=2.0.0-dev
Accept: application/ld+json; version=2.0.0-dev
--8<-- "examples/LogisticsEvent.json"
--8<-- "API-Security/examples/LogisticsEvent.json"
```

_([examples/LogisticsEvent.json](examples/LogisticsEvent.json))_
_([LogisticsEvent.json](./examples/LogisticsEvent.json))_

Response:

Expand All @@ -162,10 +162,10 @@ Host: 1r.example.com
Content-Type: application/ld+json; version=2.0.0-dev
Accept: application/ld+json; version=2.0.0-dev
--8<-- "examples/LogisticsEvent.json"
--8<-- "API-Security/examples/LogisticsEvent.json"
```

_([examples/LogisticsEvent.json](examples/LogisticsEvent.json))_
_([LogisticsEvent.json](./examples/LogisticsEvent.json))_

Response:

Expand All @@ -174,10 +174,10 @@ HTTP/1.1 404 Not Found
Content-Language: en-US
Content-Type: application/ld+json; version=2.0.0-dev

--8<-- "examples/Error_404.json"
--8<-- "API-Security/examples/Error_404.json"
```

_([examples/Error_404.json](examples/Error_404.json))_
_([Error_404.json](./examples/Error_404.json))_

# Get a Logistics Event

Expand Down Expand Up @@ -250,10 +250,10 @@ Location: https://1r.example.com/logistics-objects/1a8ded38-1804-467c-a369-81a41
Type: https://onerecord.iata.org/ns/cargo#LogisticsEvent
Last-Modified: Tue, 19 Apr 2023 07:28:00 GMT

--8<-- "examples/LogisticsEvent_with_id.json"
--8<-- "API-Security/examples/LogisticsEvent_with_id.json"
```

_([examples/LogisticsEvent_with_id.json](examples/LogisticsEvent_with_id.json))_
_([LogisticsEvent_with_id.json](./examples/LogisticsEvent_with_id.json))_

## Example B2

Expand All @@ -275,10 +275,10 @@ Content-Language: en-US
Content-Type: application/ld+json; version=2.0.0-dev
Type: https://onerecord.iata.org/ns/api/2.0.0dev#Error

--8<-- "examples/Error_404.json"
--8<-- "API-Security/examples/Error_404.json"
```

_([examples/Error_404.json](examples/Error_404.json))_
_([Error_404.json](./examples/Error_404.json))_

# Get Logistic Events of a Logistics Object

Expand Down Expand Up @@ -396,9 +396,9 @@ HTTP/1.1 200 OK
Content-Type: application/ld+json; version=2.0.0-dev
Content-Language: en-US

--8<-- "examples/LogisticsEvents_list.json"
--8<-- "API-Security/examples/LogisticsEvents_list.json"
```
_([examples/LogisticsEvents_list.json](examples/LogisticsEvents_list.json))_
_([LogisticsEvents_list.json](./examples/LogisticsEvents_list.json))_


## Example C2
Expand All @@ -420,9 +420,9 @@ HTTP/1.1 200 OK
Content-Type: application/ld+json; version=2.0.0-dev
Content-Language: en-US

--8<-- "examples/LogisticsEvents_filtered_list.json"
--8<-- "API-Security/examples/LogisticsEvents_filtered_list.json"
```
_([examples/LogisticsEvents_filtered_list.json](examples/LogisticsEvents_filtered_list.json))_
_([LogisticsEvents_filtered_list.json](./examples/LogisticsEvents_filtered_list.json))_

## Example C3

Expand All @@ -443,6 +443,6 @@ HTTP/1.1 200 OK
Content-Type: application/ld+json; version=2.0.0-dev
Content-Language: en-US

--8<-- "examples/LogisticsEvents_empty_list.json"
--8<-- "API-Security/examples/LogisticsEvents_empty_list.json"
```
_([examples/LogisticsEvents_empty_list.json](examples/LogisticsEvents_empty_list.json))_
_([LogisticsEvents_empty_list.json](./examples/LogisticsEvents_empty_list.json))_
Loading

0 comments on commit 8dd1e6f

Please sign in to comment.