fix: Unnecessary nested structure in API response under "data" field
Description: Some API responses introduce an unnecessary nested structure under the "data" field, which includes an additional "response" object.This makes the API responses unnecessarily complex and inconsistent with other endpoints.
Method
- GET/v1/orgs/{orgId}/cred-defs/{credDefId} (Get credential definition by credential definition Id)
- POST/v1/orgs/{orgId}/question-answer/question/{connectionId} (send question)
- POST/v1/orgs/{orgId}/basic-message/{connectionId}(Send basic message)
Steps to Reproduce
- Send an API request for above mention APIs .
- Observe the response.
Current behavior
1.GET/v1/orgs/{orgId}/cred-defs/{credDefId} (Get credential definition by credential definition Id)
{ "statusCode": 200, "message": "Credential definition fetched successfully.", "data": { "response": {} } }
-
POST/v1/orgs/{orgId}/question-answer/question/{connectionId} (send question) { "statusCode": 201, "message": "Question sent successfully", "data": { "response": {} } }
-
POST/v1/orgs/{orgId}/basic-message/{connectionId}(Send basic message)
{ "statusCode": 201, "message": "Basic message sent successfully", "data": { "response": {} } }
Expected behavior
1.GET/v1/orgs/{orgId}/cred-defs/{credDefId} (Get credential definition by credential definition Id)
{ "statusCode": 200, "message": "Credential definition fetched successfully.", "data": { } }
- POST/v1/orgs/{orgId}/question-answer/question/{connectionId} (send question)
{ "statusCode": 201, "message": "Question sent successfully", "data": {} }
- POST/v1/orgs/{orgId}/basic-message/{connectionId}(Send basic message)
{ "statusCode": 201, "message": "Basic message sent successfully", "data": { } }
Screenshots
@GHkrishna I have reported an issue. Please review it when you have a chance. Let me know if you need any further information from my side. Thanks!
Hey, I'd like to work on this.
Hello @kirti763 Sure you can start working on this, assigning you this issue
@GHkrishna
I'd like to work on this.
I’d like to work on this issue. Could you please assign it to me? I’ll make sure to follow the contribution guidelines and submit a PR once it’s ready
Hi @GHkrishna I would like to work on this issue. Could you please assign it to me?
@shubhambhoite502 You can start working on it, and add a update here whenever you start
Hello @GHkrishna since it's been 3 weeks with no report about status, could you please assign the issue to me?
Hi @abraaorochapb assigned you, feel free to raise a PR
An observation, I believe the issue comes from the nats call where using a specific function from the few avaibale, add an additional mapper to nest the data field.
I had added a TODO earlier here: https://github.com/credebl/platform/blob/5f5b54d65c1513341eab504a95ac073b381ba485/libs/common/src/NATSClient.ts#L33