Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .github/workflows/api-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Wait for API to be ready
run: |
for i in {1..60}; do
if curl -fs http://127.0.0.1:8000/openapi.json; then
if curl -fs http://127.0.0.1:8000/api/v2/openapi.json; then
echo "API ready"
exit 0
fi
Expand All @@ -77,6 +77,7 @@ jobs:
source .venv/bin/activate
python schema-validator/verification/api-validator.py \
--baseurl http://127.0.0.1:8000 \
--schema-url http://127.0.0.1:8000/api/v2/openapi.json \
--report-name schemathesis-local
echo "exitcode=$?" >> $GITHUB_OUTPUT

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ If using docker (see next section), your dockerfile could extend this reference

- `API_URL_ROOT`: the base url when constructing links returned by the api (eg.: https://iri.myfacility.com)
- `API_PREFIX`: the path prefix where the api is hosted. Defaults to `/`. (eg.: `/api`)
- `API_URL`: the path to the api itself. Defaults to `api/v1`.
- `API_URL`: the path to the api itself. Defaults to `api/v2`.
### OpenTelemetry

The API supports OpenTelemetry for distributed tracing and metrics. Traces and metrics can be independently enabled or disabled.
Expand Down
6 changes: 3 additions & 3 deletions VALIDATION.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ On every pull request or push to `main` branch, Github Actions run the following

1. Builds the Facility API Docker image from Dockerfile.
2. Runs the API container with demo adapter.
3. Waits for `/openapi.json` to become available on localhost:8000.
3. Waits for `/api/v2/openapi.json` to become available on localhost:8000.
4. Runs Schemathesis validation twice:
- Against Facilities API’s OpenAPI spec. (http://localhost:8000/openapi.json)
- Against Facilities API’s OpenAPI spec. (http://localhost:8000/api/v2/openapi.json)
- Against the official IRI Facility API OpenAPI spec. (https://github.com/doe-iri/iri-facility-api-docs/blob/main/specification/openapi/openapi_iri_facility_api_v2.json)
5. Fails the workflow if either validation fails.
6. Saves Schemathesis HTML/XML reports as artifacts (or saves it locally when run with `act`).
Expand All @@ -15,7 +15,7 @@ On every pull request or push to `main` branch, Github Actions run the following
## Running locally

```bash
act -W .github/workflows/api-validator.yml -s GITHUB_TOKEN=<GITHUB_TOKEN>
act -W .github/workflows/api-validation.yml -s GITHUB_TOKEN=<GITHUB_TOKEN>
```

## Known issues
Expand Down
8 changes: 4 additions & 4 deletions test/test_proxy_prefix_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_status_resources_uses_forwarded_prefix_in_absolute_urls(self):
client = TestClient(APP)

response = client.get(
"/api/v1/status/resources",
"/api/v2/status/resources",
headers={
"x-forwarded-host": "localhost.rig.american-science-cloud.org",
"x-forwarded-proto": "https",
Expand All @@ -31,18 +31,18 @@ def test_status_resources_uses_forwarded_prefix_in_absolute_urls(self):
first = resources[0]
self.assertTrue(
first["self_uri"].startswith(
"https://localhost.rig.american-science-cloud.org/esnet-east/api/v1/status/resources/"
"https://localhost.rig.american-science-cloud.org/esnet-east/api/v2/status/resources/"
)
)
self.assertTrue(
first["site_uri"].startswith(
"https://localhost.rig.american-science-cloud.org/esnet-east/api/v1/facility/sites/"
"https://localhost.rig.american-science-cloud.org/esnet-east/api/v2/facility/sites/"
)
)
self.assertTrue(
all(
capability_uri.startswith(
"https://localhost.rig.american-science-cloud.org/esnet-east/api/v1/account/capabilities/"
"https://localhost.rig.american-science-cloud.org/esnet-east/api/v2/account/capabilities/"
)
for capability_uri in first["capability_uris"]
)
Expand Down
Loading