Skip to content

Commit

Permalink
Refactor API Things endpoints
Browse files Browse the repository at this point in the history
- Update API endpoints, error codes, schemas, and validation patterns
- Improve descriptions and documentation for various components
- Add operation IDs and links for operations

Signed-off-by: Rodney Osodo <[email protected]>
  • Loading branch information
rodneyosodo committed Feb 26, 2024
1 parent d886f31 commit d23d4ca
Show file tree
Hide file tree
Showing 5 changed files with 250 additions and 6 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/api-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ on:
- main

env:
TOKEN_URL: http://localhost:9002/users/tokens/issue
TOKENS_URL: http://localhost:9002/users/tokens/issue
DOMAINS_URL: http://localhost:8189/domains
USER_IDENTITY: [email protected]
USER_SECRET: 12345678
DOMAIN_NAME: demo-test

jobs:
api-test:
Expand All @@ -37,7 +39,9 @@ jobs:

- name: Set access token
run: |
export USER_TOKEN=$(curl -sSX POST $TOKEN_URL -H "Content-Type: application/json" -d "{\"identity\": \"$USER_IDENTITY\",\"secret\": \"$USER_SECRET\"}" | jq -r .access_token)
export USER_TOKEN=$(curl -sSX POST $TOKENS_URL -H "Content-Type: application/json" -d "{\"identity\": \"$USER_IDENTITY\",\"secret\": \"$USER_SECRET\"}" | jq -r .access_token)
export DOMAIN_ID=$(curl -sSX POST $DOMAINS_URL -H "Content-Type: application/json" -H "Authorization: Bearer $USER_TOKEN" -d "{\"name\":\"$DOMAIN_NAME\",\"alias\":\"$DOMAIN_NAME\"}" | jq -r .id)
export USER_TOKEN=$(curl -sSX POST $TOKENS_URL -H "Content-Type: application/json" -d "{\"identity\": \"$USER_IDENTITY\",\"secret\": \"$USER_SECRET\",\"domain_id\": \"$DOMAIN_ID\"}" | jq -r .access_token)
echo "USER_TOKEN=$USER_TOKEN" >> $GITHUB_ENV
- name: Run Users API tests
Expand All @@ -49,6 +53,15 @@ jobs:
report: false
args: '--header "Authorization: Bearer ${{ env.USER_TOKEN }}" --contrib-openapi-formats-uuid --hypothesis-suppress-health-check=filter_too_much --stateful=links'

- name: Run Things API tests
uses: schemathesis/action@v1
with:
schema: api/openapi/things.yml
base-url: http://localhost:9000
checks: all
report: false
args: '--header "Authorization: Bearer ${{ env.USER_TOKEN }}" --contrib-unique-data --contrib-openapi-formats-uuid --hypothesis-suppress-health-check=filter_too_much --stateful=links'

- name: Stop containers
if: always()
run: make run down args="-v"
4 changes: 2 additions & 2 deletions api/openapi/auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ info:
version: 0.14.0

servers:
- url: http://localhost:8180
- url: https://localhost:8180
- url: http://localhost:8189
- url: https://localhost:8189

tags:
- name: Auth
Expand Down
Loading

0 comments on commit d23d4ca

Please sign in to comment.