platform icon indicating copy to clipboard operation
platform copied to clipboard

fix: Unnecessary nested structure in API response under "data" field

Open sayali-chavan2396 opened this issue 7 months ago • 10 comments

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

  1. GET/v1/orgs/{orgId}/cred-defs/{credDefId} (Get credential definition by credential definition Id)
  2. POST/v1/orgs/{orgId}/question-answer/question/{connectionId} (send question)
  3. POST/v1/orgs/{orgId}/basic-message/{connectionId}(Send basic message)

Steps to Reproduce

  1. Send an API request for above mention APIs .
  2. 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": {} } }

  1. POST/v1/orgs/{orgId}/question-answer/question/{connectionId} (send question) { "statusCode": 201, "message": "Question sent successfully", "data": { "response": {} } }

  2. 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": { } }

  1. POST/v1/orgs/{orgId}/question-answer/question/{connectionId} (send question)

{ "statusCode": 201, "message": "Question sent successfully", "data": {} }

  1. POST/v1/orgs/{orgId}/basic-message/{connectionId}(Send basic message)

{ "statusCode": 201, "message": "Basic message sent successfully", "data": { } }

Screenshots

Image

Image

Image

sayali-chavan2396 avatar May 08 '25 13:05 sayali-chavan2396

@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!

sayali-chavan2396 avatar May 09 '25 06:05 sayali-chavan2396

Hey, I'd like to work on this.

kirti763 avatar May 12 '25 20:05 kirti763

Hello @kirti763 Sure you can start working on this, assigning you this issue

GHkrishna avatar May 13 '25 05:05 GHkrishna

@GHkrishna
I'd like to work on this.

Muhammad-Aman1718 avatar Jun 27 '25 21:06 Muhammad-Aman1718

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

cmdsreedev avatar Sep 15 '25 15:09 cmdsreedev

Hi @GHkrishna I would like to work on this issue. Could you please assign it to me?

shubhambhoite502 avatar Oct 02 '25 09:10 shubhambhoite502

@shubhambhoite502 You can start working on it, and add a update here whenever you start

GHkrishna avatar Oct 03 '25 05:10 GHkrishna

Hello @GHkrishna since it's been 3 weeks with no report about status, could you please assign the issue to me?

abraaorochapb avatar Oct 20 '25 23:10 abraaorochapb

Hi @abraaorochapb assigned you, feel free to raise a PR

GHkrishna avatar Oct 21 '25 06:10 GHkrishna

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

GHkrishna avatar Oct 21 '25 06:10 GHkrishna