diff --git a/.github/workflows/api-validation.yml b/.github/workflows/api-validation.yml index adfcd92a..370ff65e 100644 --- a/.github/workflows/api-validation.yml +++ b/.github/workflows/api-validation.yml @@ -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 @@ -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 diff --git a/README.md b/README.md index 9b00ea78..fb5035c2 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/VALIDATION.MD b/VALIDATION.MD index b9988311..b3f21fd4 100644 --- a/VALIDATION.MD +++ b/VALIDATION.MD @@ -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`). @@ -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= +act -W .github/workflows/api-validation.yml -s GITHUB_TOKEN= ``` ## Known issues diff --git a/test/test_proxy_prefix_urls.py b/test/test_proxy_prefix_urls.py index cea25806..64b75b6b 100644 --- a/test/test_proxy_prefix_urls.py +++ b/test/test_proxy_prefix_urls.py @@ -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", @@ -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"] )