You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.
Functions on retrieved instances derived from a ConvectorModel like history and query promise to return an instance of a defined ConvectorModel. For example history(): Promise<History<T>[]>;
The Template T is as I understand it a model extending ConvectorModel.
Instead of returning an object of type T it returns an object where every key has the prefix '_' to the keys defined in T.
Current Behavior
history(): Promise<History<T>[]> does not return Promise<History<T>[]> but Promise<History<T2>[]> where T2 has '_' as the prefix to every key defined in T.
Expected Behavior
history(): Promise<History<T>[]> should actually return Promise<History<T>[]>
I think this is because those functions call the chaincode and just return the object returned from hyperledger fabric (I therefore suspect that all values are strings too). My expectation would be that the returned object would be cast to the specified ConvectorModel.
The text was updated successfully, but these errors were encountered:
This is a problem in the way that Fabric is returning the response to client. A fix for this is in the way, expected to be merged and released in the next week.
In the meantime you can overcome this by doing (await myModel.history()) .map(item => ({...item, value: item.value.toJSON()}));, not a sexy fix, but can get you out of the problem right now.
The problem
Functions on retrieved instances derived from a ConvectorModel like history and query promise to return an instance of a defined ConvectorModel. For example history(): Promise<History<T>[]>;
The Template T is as I understand it a model extending ConvectorModel.
Instead of returning an object of type T it returns an object where every key has the prefix '_' to the keys defined in T.
Current Behavior
history(): Promise<History<T>[]> does not return Promise<History<T>[]> but Promise<History<T2>[]> where T2 has '_' as the prefix to every key defined in T.
Expected Behavior
history(): Promise<History<T>[]> should actually return Promise<History<T>[]>
I think this is because those functions call the chaincode and just return the object returned from hyperledger fabric (I therefore suspect that all values are strings too). My expectation would be that the returned object would be cast to the specified ConvectorModel.
The text was updated successfully, but these errors were encountered: