From 2e9538bac3c71d45681022c8b83a98af21ce2397 Mon Sep 17 00:00:00 2001 From: Vinay Ingalahalli Date: Wed, 15 Apr 2026 10:44:37 +0530 Subject: [PATCH 1/4] Fix governance violations in spec --- .postman/resources.yaml | 7 ++++ .postman/workflows.yaml | 11 +++++++ contract/index.yaml | 1 + .../.resources/definition.yaml | 12 +++++++ .../v1/.resources/definition.yaml | 2 ++ .../v1/users/.resources/definition.yaml | 2 ++ .../examples/Error occurred.example.yaml | 31 +++++++++++++++++ .../examples/Unauthorized.example.yaml | 31 +++++++++++++++++ .../User logged in successfully.example.yaml | 33 +++++++++++++++++++ .../v1/users/login/.resources/definition.yaml | 2 ++ .../v1/users/login/Log in a user.request.yaml | 15 +++++++++ .../examples/Error occurred.example.yaml | 31 +++++++++++++++++ .../User registered successfully.example.yaml | 33 +++++++++++++++++++ .../users/register/.resources/definition.yaml | 2 ++ .../register/Register a new user.request.yaml | 15 +++++++++ .../examples/Error occurred.example.yaml | 27 +++++++++++++++ .../User deleted successfully.example.yaml | 27 +++++++++++++++ .../examples/Error occurred.example.yaml | 27 +++++++++++++++ .../Successful operation.example.yaml | 28 ++++++++++++++++ .../examples/User not found.example.yaml | 27 +++++++++++++++ .../examples/Error occurred.example.yaml | 33 +++++++++++++++++++ .../User updated successfully.example.yaml | 33 +++++++++++++++++++ .../v1/users/{id}/.resources/definition.yaml | 2 ++ .../v1/users/{id}/Delete a user.request.yaml | 12 +++++++ .../users/{id}/Retrieve a user.request.yaml | 12 +++++++ .../v1/users/{id}/Update a user.request.yaml | 17 ++++++++++ postman/globals/workspace.globals.yaml | 2 ++ 27 files changed, 475 insertions(+) create mode 100644 .postman/resources.yaml create mode 100644 .postman/workflows.yaml create mode 100644 postman/collections/User API Integration Tests/.resources/definition.yaml create mode 100644 postman/collections/User API Integration Tests/v1/.resources/definition.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/.resources/definition.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/login/.resources/Log in a user.resources/examples/Error occurred.example.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/login/.resources/Log in a user.resources/examples/Unauthorized.example.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/login/.resources/Log in a user.resources/examples/User logged in successfully.example.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/login/.resources/definition.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/login/Log in a user.request.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/register/.resources/Register a new user.resources/examples/Error occurred.example.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/register/.resources/Register a new user.resources/examples/User registered successfully.example.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/register/.resources/definition.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/register/Register a new user.request.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/{id}/.resources/Delete a user.resources/examples/Error occurred.example.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/{id}/.resources/Delete a user.resources/examples/User deleted successfully.example.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/{id}/.resources/Retrieve a user.resources/examples/Error occurred.example.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/{id}/.resources/Retrieve a user.resources/examples/Successful operation.example.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/{id}/.resources/Retrieve a user.resources/examples/User not found.example.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/{id}/.resources/Update a user.resources/examples/Error occurred.example.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/{id}/.resources/Update a user.resources/examples/User updated successfully.example.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/{id}/.resources/definition.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/{id}/Delete a user.request.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/{id}/Retrieve a user.request.yaml create mode 100644 postman/collections/User API Integration Tests/v1/users/{id}/Update a user.request.yaml create mode 100644 postman/globals/workspace.globals.yaml diff --git a/.postman/resources.yaml b/.postman/resources.yaml new file mode 100644 index 0000000..d69e467 --- /dev/null +++ b/.postman/resources.yaml @@ -0,0 +1,7 @@ +# Use this workspace to collaborate +workspace: + id: 44f0c4cc-b67e-48d2-a673-92518ff59507 + +localResources: + specs: + - ../contract/index.yaml diff --git a/.postman/workflows.yaml b/.postman/workflows.yaml new file mode 100644 index 0000000..d1218f9 --- /dev/null +++ b/.postman/workflows.yaml @@ -0,0 +1,11 @@ +# This is a Workflow metadata file for defining entity relationships in this workspace. +# Each workflow defines relations between entities and may include optional behavior/settings. +# The Paths are relative to the .postman directory (avoid absolute paths). +# Keep relation entries explicit and avoid duplicate pairs within the same workflow. +# This file is declarative metadata and does not execute workflows by itself. +workflows: + syncSpecToCollection: + - spec: ../contract/index.yaml + collection: ../postman/collections/User API Integration Tests + options: + syncExamples: false diff --git a/contract/index.yaml b/contract/index.yaml index cb9181a..12cf7b6 100644 --- a/contract/index.yaml +++ b/contract/index.yaml @@ -1,5 +1,6 @@ openapi: 3.0.0 info: + description: for practice title: User API version: 1.0.0 paths: diff --git a/postman/collections/User API Integration Tests/.resources/definition.yaml b/postman/collections/User API Integration Tests/.resources/definition.yaml new file mode 100644 index 0000000..0876688 --- /dev/null +++ b/postman/collections/User API Integration Tests/.resources/definition.yaml @@ -0,0 +1,12 @@ +$kind: collection +description: for practice +variables: + baseUrl: / +auth: + - id: a00f4834-a16a-4d97-b35a-5143964d65a1 + type: apikey + name: apikey auth + credentials: + key: X-API-Key + value: "{{apiKey}}" + in: header diff --git a/postman/collections/User API Integration Tests/v1/.resources/definition.yaml b/postman/collections/User API Integration Tests/v1/.resources/definition.yaml new file mode 100644 index 0000000..53d990d --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/.resources/definition.yaml @@ -0,0 +1,2 @@ +$kind: collection +order: 1000 diff --git a/postman/collections/User API Integration Tests/v1/users/.resources/definition.yaml b/postman/collections/User API Integration Tests/v1/users/.resources/definition.yaml new file mode 100644 index 0000000..53d990d --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/.resources/definition.yaml @@ -0,0 +1,2 @@ +$kind: collection +order: 1000 diff --git a/postman/collections/User API Integration Tests/v1/users/login/.resources/Log in a user.resources/examples/Error occurred.example.yaml b/postman/collections/User API Integration Tests/v1/users/login/.resources/Log in a user.resources/examples/Error occurred.example.yaml new file mode 100644 index 0000000..c77403e --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/login/.resources/Log in a user.resources/examples/Error occurred.example.yaml @@ -0,0 +1,31 @@ +$kind: http-example +request: + url: "{{baseUrl}}/v1/users/login" + method: POST + headers: + - key: Content-Type + value: application/json + - key: Accept + value: application/json + - key: X-API-Key + value: + description: "Added as a part of security scheme: apikey" + body: + type: json + content: |- + { + "username": "string", + "password": "string" + } +response: + statusCode: 500 + statusText: Internal Server Error + headers: + Content-Type: application/json + body: + type: json + content: |- + { + "message": "string" + } +order: 3000 diff --git a/postman/collections/User API Integration Tests/v1/users/login/.resources/Log in a user.resources/examples/Unauthorized.example.yaml b/postman/collections/User API Integration Tests/v1/users/login/.resources/Log in a user.resources/examples/Unauthorized.example.yaml new file mode 100644 index 0000000..546f8fd --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/login/.resources/Log in a user.resources/examples/Unauthorized.example.yaml @@ -0,0 +1,31 @@ +$kind: http-example +request: + url: "{{baseUrl}}/v1/users/login" + method: POST + headers: + - key: Content-Type + value: application/json + - key: Accept + value: application/json + - key: X-API-Key + value: + description: "Added as a part of security scheme: apikey" + body: + type: json + content: |- + { + "username": "string", + "password": "string" + } +response: + statusCode: 401 + statusText: Unauthorized + headers: + Content-Type: application/json + body: + type: json + content: |- + { + "message": "string" + } +order: 2000 diff --git a/postman/collections/User API Integration Tests/v1/users/login/.resources/Log in a user.resources/examples/User logged in successfully.example.yaml b/postman/collections/User API Integration Tests/v1/users/login/.resources/Log in a user.resources/examples/User logged in successfully.example.yaml new file mode 100644 index 0000000..3d6964d --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/login/.resources/Log in a user.resources/examples/User logged in successfully.example.yaml @@ -0,0 +1,33 @@ +$kind: http-example +request: + url: "{{baseUrl}}/v1/users/login" + method: POST + headers: + - key: Content-Type + value: application/json + - key: Accept + value: application/json + - key: X-API-Key + value: + description: "Added as a part of security scheme: apikey" + body: + type: json + content: |- + { + "username": "string", + "password": "string" + } +response: + statusCode: 200 + statusText: OK + headers: + Content-Type: application/json + body: + type: json + content: |- + { + "id": 9115, + "username": "string", + "token": "string" + } +order: 1000 diff --git a/postman/collections/User API Integration Tests/v1/users/login/.resources/definition.yaml b/postman/collections/User API Integration Tests/v1/users/login/.resources/definition.yaml new file mode 100644 index 0000000..6522e17 --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/login/.resources/definition.yaml @@ -0,0 +1,2 @@ +$kind: collection +order: 2000 diff --git a/postman/collections/User API Integration Tests/v1/users/login/Log in a user.request.yaml b/postman/collections/User API Integration Tests/v1/users/login/Log in a user.request.yaml new file mode 100644 index 0000000..76d34f9 --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/login/Log in a user.request.yaml @@ -0,0 +1,15 @@ +$kind: http-request +url: "{{baseUrl}}/v1/users/login" +method: POST +headers: + Content-Type: application/json + Accept: application/json +body: + type: json + content: |- + { + "username": "string", + "password": "string" + } +examples: ./.resources/Log in a user.resources/examples +order: 1000 diff --git a/postman/collections/User API Integration Tests/v1/users/register/.resources/Register a new user.resources/examples/Error occurred.example.yaml b/postman/collections/User API Integration Tests/v1/users/register/.resources/Register a new user.resources/examples/Error occurred.example.yaml new file mode 100644 index 0000000..ebe0f21 --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/register/.resources/Register a new user.resources/examples/Error occurred.example.yaml @@ -0,0 +1,31 @@ +$kind: http-example +request: + url: "{{baseUrl}}/v1/users/register" + method: POST + headers: + - key: Content-Type + value: application/json + - key: Accept + value: application/json + - key: X-API-Key + value: + description: "Added as a part of security scheme: apikey" + body: + type: json + content: |- + { + "username": "string", + "password": "string" + } +response: + statusCode: 500 + statusText: Internal Server Error + headers: + Content-Type: application/json + body: + type: json + content: |- + { + "message": "string" + } +order: 2000 diff --git a/postman/collections/User API Integration Tests/v1/users/register/.resources/Register a new user.resources/examples/User registered successfully.example.yaml b/postman/collections/User API Integration Tests/v1/users/register/.resources/Register a new user.resources/examples/User registered successfully.example.yaml new file mode 100644 index 0000000..18b25ee --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/register/.resources/Register a new user.resources/examples/User registered successfully.example.yaml @@ -0,0 +1,33 @@ +$kind: http-example +request: + url: "{{baseUrl}}/v1/users/register" + method: POST + headers: + - key: Content-Type + value: application/json + - key: Accept + value: application/json + - key: X-API-Key + value: + description: "Added as a part of security scheme: apikey" + body: + type: json + content: |- + { + "username": "string", + "password": "string" + } +response: + statusCode: 201 + statusText: Created + headers: + Content-Type: application/json + body: + type: json + content: |- + { + "id": 9115, + "username": "string", + "token": "string" + } +order: 1000 diff --git a/postman/collections/User API Integration Tests/v1/users/register/.resources/definition.yaml b/postman/collections/User API Integration Tests/v1/users/register/.resources/definition.yaml new file mode 100644 index 0000000..53d990d --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/register/.resources/definition.yaml @@ -0,0 +1,2 @@ +$kind: collection +order: 1000 diff --git a/postman/collections/User API Integration Tests/v1/users/register/Register a new user.request.yaml b/postman/collections/User API Integration Tests/v1/users/register/Register a new user.request.yaml new file mode 100644 index 0000000..36bd814 --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/register/Register a new user.request.yaml @@ -0,0 +1,15 @@ +$kind: http-request +url: "{{baseUrl}}/v1/users/register" +method: POST +headers: + Content-Type: application/json + Accept: application/json +body: + type: json + content: |- + { + "username": "string", + "password": "string" + } +examples: ./.resources/Register a new user.resources/examples +order: 1000 diff --git a/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Delete a user.resources/examples/Error occurred.example.yaml b/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Delete a user.resources/examples/Error occurred.example.yaml new file mode 100644 index 0000000..b07081b --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Delete a user.resources/examples/Error occurred.example.yaml @@ -0,0 +1,27 @@ +$kind: http-example +request: + url: "{{baseUrl}}/v1/users/:id" + method: DELETE + headers: + - key: Accept + value: application/json + - key: X-API-Key + value: + description: "Added as a part of security scheme: apikey" + pathVariables: + id: "9696" + body: + type: text + content: "" +response: + statusCode: 500 + statusText: Internal Server Error + headers: + Content-Type: application/json + body: + type: json + content: |- + { + "message": "string" + } +order: 2000 diff --git a/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Delete a user.resources/examples/User deleted successfully.example.yaml b/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Delete a user.resources/examples/User deleted successfully.example.yaml new file mode 100644 index 0000000..c294399 --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Delete a user.resources/examples/User deleted successfully.example.yaml @@ -0,0 +1,27 @@ +$kind: http-example +request: + url: "{{baseUrl}}/v1/users/:id" + method: DELETE + headers: + - key: Accept + value: application/json + - key: X-API-Key + value: + description: "Added as a part of security scheme: apikey" + pathVariables: + id: "9696" + body: + type: text + content: "" +response: + statusCode: 200 + statusText: OK + headers: + Content-Type: application/json + body: + type: json + content: |- + { + "message": "string" + } +order: 1000 diff --git a/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Retrieve a user.resources/examples/Error occurred.example.yaml b/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Retrieve a user.resources/examples/Error occurred.example.yaml new file mode 100644 index 0000000..7d94db0 --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Retrieve a user.resources/examples/Error occurred.example.yaml @@ -0,0 +1,27 @@ +$kind: http-example +request: + url: "{{baseUrl}}/v1/users/:id" + method: GET + headers: + - key: Accept + value: application/json + - key: X-API-Key + value: + description: "Added as a part of security scheme: apikey" + pathVariables: + id: "9696" + body: + type: text + content: "" +response: + statusCode: 500 + statusText: Internal Server Error + headers: + Content-Type: application/json + body: + type: json + content: |- + { + "message": "string" + } +order: 3000 diff --git a/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Retrieve a user.resources/examples/Successful operation.example.yaml b/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Retrieve a user.resources/examples/Successful operation.example.yaml new file mode 100644 index 0000000..ab42e65 --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Retrieve a user.resources/examples/Successful operation.example.yaml @@ -0,0 +1,28 @@ +$kind: http-example +request: + url: "{{baseUrl}}/v1/users/:id" + method: GET + headers: + - key: Accept + value: application/json + - key: X-API-Key + value: + description: "Added as a part of security scheme: apikey" + pathVariables: + id: "9696" + body: + type: text + content: "" +response: + statusCode: 200 + statusText: OK + headers: + Content-Type: application/json + body: + type: json + content: |- + { + "id": 4696, + "username": "string" + } +order: 1000 diff --git a/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Retrieve a user.resources/examples/User not found.example.yaml b/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Retrieve a user.resources/examples/User not found.example.yaml new file mode 100644 index 0000000..debc6a4 --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Retrieve a user.resources/examples/User not found.example.yaml @@ -0,0 +1,27 @@ +$kind: http-example +request: + url: "{{baseUrl}}/v1/users/:id" + method: GET + headers: + - key: Accept + value: application/json + - key: X-API-Key + value: + description: "Added as a part of security scheme: apikey" + pathVariables: + id: "9696" + body: + type: text + content: "" +response: + statusCode: 404 + statusText: Not Found + headers: + Content-Type: application/json + body: + type: json + content: |- + { + "message": "string" + } +order: 2000 diff --git a/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Update a user.resources/examples/Error occurred.example.yaml b/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Update a user.resources/examples/Error occurred.example.yaml new file mode 100644 index 0000000..7f8e50e --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Update a user.resources/examples/Error occurred.example.yaml @@ -0,0 +1,33 @@ +$kind: http-example +request: + url: "{{baseUrl}}/v1/users/:id" + method: PUT + headers: + - key: Content-Type + value: application/json + - key: Accept + value: application/json + - key: X-API-Key + value: + description: "Added as a part of security scheme: apikey" + pathVariables: + id: "9696" + body: + type: json + content: |- + { + "username": "string", + "password": "string" + } +response: + statusCode: 500 + statusText: Internal Server Error + headers: + Content-Type: application/json + body: + type: json + content: |- + { + "message": "string" + } +order: 2000 diff --git a/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Update a user.resources/examples/User updated successfully.example.yaml b/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Update a user.resources/examples/User updated successfully.example.yaml new file mode 100644 index 0000000..c0941c4 --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Update a user.resources/examples/User updated successfully.example.yaml @@ -0,0 +1,33 @@ +$kind: http-example +request: + url: "{{baseUrl}}/v1/users/:id" + method: PUT + headers: + - key: Content-Type + value: application/json + - key: Accept + value: application/json + - key: X-API-Key + value: + description: "Added as a part of security scheme: apikey" + pathVariables: + id: "9696" + body: + type: json + content: |- + { + "username": "string", + "password": "string" + } +response: + statusCode: 200 + statusText: OK + headers: + Content-Type: application/json + body: + type: json + content: |- + { + "message": "string" + } +order: 1000 diff --git a/postman/collections/User API Integration Tests/v1/users/{id}/.resources/definition.yaml b/postman/collections/User API Integration Tests/v1/users/{id}/.resources/definition.yaml new file mode 100644 index 0000000..40bbb1c --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/{id}/.resources/definition.yaml @@ -0,0 +1,2 @@ +$kind: collection +order: 3000 diff --git a/postman/collections/User API Integration Tests/v1/users/{id}/Delete a user.request.yaml b/postman/collections/User API Integration Tests/v1/users/{id}/Delete a user.request.yaml new file mode 100644 index 0000000..58b1048 --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/{id}/Delete a user.request.yaml @@ -0,0 +1,12 @@ +$kind: http-request +url: "{{baseUrl}}/v1/users/:id" +method: DELETE +headers: + Accept: application/json +pathVariables: + id: "9696" +body: + type: text + content: "" +examples: ./.resources/Delete a user.resources/examples +order: 3000 diff --git a/postman/collections/User API Integration Tests/v1/users/{id}/Retrieve a user.request.yaml b/postman/collections/User API Integration Tests/v1/users/{id}/Retrieve a user.request.yaml new file mode 100644 index 0000000..7548680 --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/{id}/Retrieve a user.request.yaml @@ -0,0 +1,12 @@ +$kind: http-request +url: "{{baseUrl}}/v1/users/:id" +method: GET +headers: + Accept: application/json +pathVariables: + id: "9696" +body: + type: text + content: "" +examples: ./.resources/Retrieve a user.resources/examples +order: 1000 diff --git a/postman/collections/User API Integration Tests/v1/users/{id}/Update a user.request.yaml b/postman/collections/User API Integration Tests/v1/users/{id}/Update a user.request.yaml new file mode 100644 index 0000000..e54eba9 --- /dev/null +++ b/postman/collections/User API Integration Tests/v1/users/{id}/Update a user.request.yaml @@ -0,0 +1,17 @@ +$kind: http-request +url: "{{baseUrl}}/v1/users/:id" +method: PUT +headers: + Content-Type: application/json + Accept: application/json +pathVariables: + id: "9696" +body: + type: json + content: |- + { + "username": "string", + "password": "string" + } +examples: ./.resources/Update a user.resources/examples +order: 2000 diff --git a/postman/globals/workspace.globals.yaml b/postman/globals/workspace.globals.yaml new file mode 100644 index 0000000..e96c6d6 --- /dev/null +++ b/postman/globals/workspace.globals.yaml @@ -0,0 +1,2 @@ +name: Globals +values: [] From b2c3927453d6b97cd07130e6e0bb3feb7b26c25c Mon Sep 17 00:00:00 2001 From: Vinay Ingalahalli Date: Wed, 15 Apr 2026 11:33:19 +0530 Subject: [PATCH 2/4] integration test added --- .postman/resources.yaml | 2 +- .../v1/users/login/Log in a user.request.yaml | 12 +++++-- .../register/Register a new user.request.yaml | 18 ++++++++-- .../examples/Error occurred.example.yaml | 33 ------------------- .../User updated successfully.example.yaml | 33 ------------------- .../v1/users/{id}/Delete a user.request.yaml | 12 ++++++- .../users/{id}/Retrieve a user.request.yaml | 12 ++++++- .../v1/users/{id}/Update a user.request.yaml | 17 ---------- .../Staging Environment.environment.yaml | 9 +++++ 9 files changed, 58 insertions(+), 90 deletions(-) delete mode 100644 postman/collections/User API Integration Tests/v1/users/{id}/.resources/Update a user.resources/examples/Error occurred.example.yaml delete mode 100644 postman/collections/User API Integration Tests/v1/users/{id}/.resources/Update a user.resources/examples/User updated successfully.example.yaml delete mode 100644 postman/collections/User API Integration Tests/v1/users/{id}/Update a user.request.yaml create mode 100644 postman/environments/Staging Environment.environment.yaml diff --git a/.postman/resources.yaml b/.postman/resources.yaml index d69e467..0233f5e 100644 --- a/.postman/resources.yaml +++ b/.postman/resources.yaml @@ -1,6 +1,6 @@ # Use this workspace to collaborate workspace: - id: 44f0c4cc-b67e-48d2-a673-92518ff59507 + id: "" localResources: specs: diff --git a/postman/collections/User API Integration Tests/v1/users/login/Log in a user.request.yaml b/postman/collections/User API Integration Tests/v1/users/login/Log in a user.request.yaml index 76d34f9..e09ded6 100644 --- a/postman/collections/User API Integration Tests/v1/users/login/Log in a user.request.yaml +++ b/postman/collections/User API Integration Tests/v1/users/login/Log in a user.request.yaml @@ -1,4 +1,5 @@ $kind: http-request +name: Log in a user url: "{{baseUrl}}/v1/users/login" method: POST headers: @@ -8,8 +9,15 @@ body: type: json content: |- { - "username": "string", - "password": "string" + "username": "{{username}}", + "password": "{{password}}" } examples: ./.resources/Log in a user.resources/examples order: 1000 +scripts: + - type: afterResponse + code: |- + pm.test("Status code is 200", function () { + pm.response.to.have.status(200); + }); + language: text/javascript diff --git a/postman/collections/User API Integration Tests/v1/users/register/Register a new user.request.yaml b/postman/collections/User API Integration Tests/v1/users/register/Register a new user.request.yaml index 36bd814..4d39c78 100644 --- a/postman/collections/User API Integration Tests/v1/users/register/Register a new user.request.yaml +++ b/postman/collections/User API Integration Tests/v1/users/register/Register a new user.request.yaml @@ -1,4 +1,5 @@ $kind: http-request +name: Register a new user url: "{{baseUrl}}/v1/users/register" method: POST headers: @@ -8,8 +9,21 @@ body: type: json content: |- { - "username": "string", - "password": "string" + "username": "{{$randomUserName}}", + "password": "{{$randomPassword}}" } examples: ./.resources/Register a new user.resources/examples order: 1000 +scripts: + - type: afterResponse + code: | + pm.test("Status code is 201", function () { + pm.response.to.have.status(201); + }); + + const jsonData = pm.response.json(); + pm.variables.set("username", jsonData.username); + pm.variables.set("id", jsonData.id); + const requestBody = JSON.parse(pm.request.body) + pm.variables.set("password", requestBody.password); + language: text/javascript diff --git a/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Update a user.resources/examples/Error occurred.example.yaml b/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Update a user.resources/examples/Error occurred.example.yaml deleted file mode 100644 index 7f8e50e..0000000 --- a/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Update a user.resources/examples/Error occurred.example.yaml +++ /dev/null @@ -1,33 +0,0 @@ -$kind: http-example -request: - url: "{{baseUrl}}/v1/users/:id" - method: PUT - headers: - - key: Content-Type - value: application/json - - key: Accept - value: application/json - - key: X-API-Key - value: - description: "Added as a part of security scheme: apikey" - pathVariables: - id: "9696" - body: - type: json - content: |- - { - "username": "string", - "password": "string" - } -response: - statusCode: 500 - statusText: Internal Server Error - headers: - Content-Type: application/json - body: - type: json - content: |- - { - "message": "string" - } -order: 2000 diff --git a/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Update a user.resources/examples/User updated successfully.example.yaml b/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Update a user.resources/examples/User updated successfully.example.yaml deleted file mode 100644 index c0941c4..0000000 --- a/postman/collections/User API Integration Tests/v1/users/{id}/.resources/Update a user.resources/examples/User updated successfully.example.yaml +++ /dev/null @@ -1,33 +0,0 @@ -$kind: http-example -request: - url: "{{baseUrl}}/v1/users/:id" - method: PUT - headers: - - key: Content-Type - value: application/json - - key: Accept - value: application/json - - key: X-API-Key - value: - description: "Added as a part of security scheme: apikey" - pathVariables: - id: "9696" - body: - type: json - content: |- - { - "username": "string", - "password": "string" - } -response: - statusCode: 200 - statusText: OK - headers: - Content-Type: application/json - body: - type: json - content: |- - { - "message": "string" - } -order: 1000 diff --git a/postman/collections/User API Integration Tests/v1/users/{id}/Delete a user.request.yaml b/postman/collections/User API Integration Tests/v1/users/{id}/Delete a user.request.yaml index 58b1048..d325ba0 100644 --- a/postman/collections/User API Integration Tests/v1/users/{id}/Delete a user.request.yaml +++ b/postman/collections/User API Integration Tests/v1/users/{id}/Delete a user.request.yaml @@ -1,12 +1,22 @@ $kind: http-request +name: Delete a user url: "{{baseUrl}}/v1/users/:id" method: DELETE headers: Accept: application/json pathVariables: - id: "9696" + - key: id + value: "{{id}}" + $type: "" body: type: text content: "" examples: ./.resources/Delete a user.resources/examples order: 3000 +scripts: + - type: afterResponse + code: |- + pm.test("Status code is 200", function () { + pm.response.to.have.status(200); + }); + language: text/javascript diff --git a/postman/collections/User API Integration Tests/v1/users/{id}/Retrieve a user.request.yaml b/postman/collections/User API Integration Tests/v1/users/{id}/Retrieve a user.request.yaml index 7548680..b265718 100644 --- a/postman/collections/User API Integration Tests/v1/users/{id}/Retrieve a user.request.yaml +++ b/postman/collections/User API Integration Tests/v1/users/{id}/Retrieve a user.request.yaml @@ -1,12 +1,22 @@ $kind: http-request +name: Retrieve a user url: "{{baseUrl}}/v1/users/:id" method: GET headers: Accept: application/json pathVariables: - id: "9696" + - key: id + value: "{{id}}" + $type: "" body: type: text content: "" examples: ./.resources/Retrieve a user.resources/examples order: 1000 +scripts: + - type: afterResponse + code: |- + pm.test("Status code is 200", function () { + pm.response.to.have.status(200); + }); + language: text/javascript diff --git a/postman/collections/User API Integration Tests/v1/users/{id}/Update a user.request.yaml b/postman/collections/User API Integration Tests/v1/users/{id}/Update a user.request.yaml deleted file mode 100644 index e54eba9..0000000 --- a/postman/collections/User API Integration Tests/v1/users/{id}/Update a user.request.yaml +++ /dev/null @@ -1,17 +0,0 @@ -$kind: http-request -url: "{{baseUrl}}/v1/users/:id" -method: PUT -headers: - Content-Type: application/json - Accept: application/json -pathVariables: - id: "9696" -body: - type: json - content: |- - { - "username": "string", - "password": "string" - } -examples: ./.resources/Update a user.resources/examples -order: 2000 diff --git a/postman/environments/Staging Environment.environment.yaml b/postman/environments/Staging Environment.environment.yaml new file mode 100644 index 0000000..7941f78 --- /dev/null +++ b/postman/environments/Staging Environment.environment.yaml @@ -0,0 +1,9 @@ +name: Staging Environment +values: + - key: baseUrl + value: 'https://customer-education.postmanlabs.com' + enabled: true + - key: apiKey + value: '1234' + enabled: true +color: 240 From ba6cb1db2ba0d3beaff19034f75f019b38f5ac82 Mon Sep 17 00:00:00 2001 From: vinayingalahalli-maker Date: Wed, 15 Apr 2026 11:52:27 +0530 Subject: [PATCH 3/4] Create main.yml --- .github/workflows/main.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..a8e88dd --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,17 @@ +name: Automated API tests using Postman CLI + +on: push + +jobs: + automated-api-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Postman CLI + run: | + curl -o- "https://dl-cli.pstmn.io/install/linux64.sh" | sh + - name: Login to Postman CLI + run: postman login --with-api-key ${{ secrets.POSTMAN_API_KEY }} + - name: Run API tests + run: | + postman collection run "53985486-f1b73652-140b-4afd-b365-23ae14516f39" -e "53985486-ae2364ed-fa80-59b7-8e3d-32deca3c4930" --report-events From dd9cd99032c9dee6696b06e8c20c5bb60bacca2c Mon Sep 17 00:00:00 2001 From: Vinay Ingalahalli Date: Wed, 15 Apr 2026 11:53:54 +0530 Subject: [PATCH 4/4] apis updated --- .postman/resources.yaml | 10 ++++++++++ .../.resources/definition.yaml | 5 ++--- .../v1/users/login/Log in a user.request.yaml | 8 ++++---- .../v1/users/register/Register a new user.request.yaml | 8 ++++---- .../v1/users/{id}/Delete a user.request.yaml | 9 +++------ .../v1/users/{id}/Retrieve a user.request.yaml | 9 +++------ .../environments/Staging Environment.environment.yaml | 4 ++-- 7 files changed, 28 insertions(+), 25 deletions(-) diff --git a/.postman/resources.yaml b/.postman/resources.yaml index 0233f5e..cf5aefc 100644 --- a/.postman/resources.yaml +++ b/.postman/resources.yaml @@ -5,3 +5,13 @@ workspace: localResources: specs: - ../contract/index.yaml + +# Each entry here maps a local resource to one or more corresponding objects in Postman Cloud + +cloudResources: + specs: + ../contract/index.yaml: c45f6ab4-3160-48c3-bafe-117b7a29cb27 + environments: + ../postman/environments/Staging Environment.environment.yaml: 53985486-ae2364ed-fa80-59b7-8e3d-32deca3c4930 + collections: + ../postman/collections/User API Integration Tests: 53985486-f1b73652-140b-4afd-b365-23ae14516f39 diff --git a/postman/collections/User API Integration Tests/.resources/definition.yaml b/postman/collections/User API Integration Tests/.resources/definition.yaml index 0876688..2f34774 100644 --- a/postman/collections/User API Integration Tests/.resources/definition.yaml +++ b/postman/collections/User API Integration Tests/.resources/definition.yaml @@ -1,9 +1,8 @@ $kind: collection +name: User API Integration Tests description: for practice -variables: - baseUrl: / auth: - - id: a00f4834-a16a-4d97-b35a-5143964d65a1 + - id: b3545068-2904-4059-8969-97cfdaad729c type: apikey name: apikey auth credentials: diff --git a/postman/collections/User API Integration Tests/v1/users/login/Log in a user.request.yaml b/postman/collections/User API Integration Tests/v1/users/login/Log in a user.request.yaml index e09ded6..b41611f 100644 --- a/postman/collections/User API Integration Tests/v1/users/login/Log in a user.request.yaml +++ b/postman/collections/User API Integration Tests/v1/users/login/Log in a user.request.yaml @@ -9,11 +9,9 @@ body: type: json content: |- { - "username": "{{username}}", - "password": "{{password}}" + "username": "{{username}}", + "password": "{{password}}" } -examples: ./.resources/Log in a user.resources/examples -order: 1000 scripts: - type: afterResponse code: |- @@ -21,3 +19,5 @@ scripts: pm.response.to.have.status(200); }); language: text/javascript +examples: ./.resources/Log in a user.resources/examples +order: 1000 diff --git a/postman/collections/User API Integration Tests/v1/users/register/Register a new user.request.yaml b/postman/collections/User API Integration Tests/v1/users/register/Register a new user.request.yaml index 4d39c78..12c26ab 100644 --- a/postman/collections/User API Integration Tests/v1/users/register/Register a new user.request.yaml +++ b/postman/collections/User API Integration Tests/v1/users/register/Register a new user.request.yaml @@ -9,11 +9,9 @@ body: type: json content: |- { - "username": "{{$randomUserName}}", - "password": "{{$randomPassword}}" + "username": "{{$randomUserName}}", + "password": "{{$randomPassword}}" } -examples: ./.resources/Register a new user.resources/examples -order: 1000 scripts: - type: afterResponse code: | @@ -27,3 +25,5 @@ scripts: const requestBody = JSON.parse(pm.request.body) pm.variables.set("password", requestBody.password); language: text/javascript +examples: ./.resources/Register a new user.resources/examples +order: 1000 diff --git a/postman/collections/User API Integration Tests/v1/users/{id}/Delete a user.request.yaml b/postman/collections/User API Integration Tests/v1/users/{id}/Delete a user.request.yaml index d325ba0..1a6488b 100644 --- a/postman/collections/User API Integration Tests/v1/users/{id}/Delete a user.request.yaml +++ b/postman/collections/User API Integration Tests/v1/users/{id}/Delete a user.request.yaml @@ -1,18 +1,13 @@ $kind: http-request -name: Delete a user url: "{{baseUrl}}/v1/users/:id" method: DELETE headers: Accept: application/json pathVariables: - - key: id - value: "{{id}}" - $type: "" + id: "{{id}}" body: type: text content: "" -examples: ./.resources/Delete a user.resources/examples -order: 3000 scripts: - type: afterResponse code: |- @@ -20,3 +15,5 @@ scripts: pm.response.to.have.status(200); }); language: text/javascript +examples: ./.resources/Delete a user.resources/examples +order: 2000 diff --git a/postman/collections/User API Integration Tests/v1/users/{id}/Retrieve a user.request.yaml b/postman/collections/User API Integration Tests/v1/users/{id}/Retrieve a user.request.yaml index b265718..2af6794 100644 --- a/postman/collections/User API Integration Tests/v1/users/{id}/Retrieve a user.request.yaml +++ b/postman/collections/User API Integration Tests/v1/users/{id}/Retrieve a user.request.yaml @@ -1,18 +1,13 @@ $kind: http-request -name: Retrieve a user url: "{{baseUrl}}/v1/users/:id" method: GET headers: Accept: application/json pathVariables: - - key: id - value: "{{id}}" - $type: "" + id: "{{id}}" body: type: text content: "" -examples: ./.resources/Retrieve a user.resources/examples -order: 1000 scripts: - type: afterResponse code: |- @@ -20,3 +15,5 @@ scripts: pm.response.to.have.status(200); }); language: text/javascript +examples: ./.resources/Retrieve a user.resources/examples +order: 1000 diff --git a/postman/environments/Staging Environment.environment.yaml b/postman/environments/Staging Environment.environment.yaml index 7941f78..523c9ba 100644 --- a/postman/environments/Staging Environment.environment.yaml +++ b/postman/environments/Staging Environment.environment.yaml @@ -1,9 +1,9 @@ name: Staging Environment values: - key: baseUrl - value: 'https://customer-education.postmanlabs.com' + value: https://customer-education.postmanlabs.com enabled: true - key: apiKey - value: '1234' + value: "1234" enabled: true color: 240