Conversation
b8194f9 to
ff3741d
Compare
Signed-off-by: Samuel Hellawell <sshellawell@gmail.com>
ff3741d to
254aa17
Compare
|
|
||
| // If empty object, skip it here otherwise causes problems downstream | ||
| if (schemaKeys.size === 0) { | ||
| delete schemaProps[key]; |
There was a problem hiding this comment.
This isn't needed as it will ignore credential values for which the schema has an empty object type. Such a schema is not valid and an error should be thrown. Secondly, is ignoring those fields what you want?
There was a problem hiding this comment.
This isn't needed as it will ignore credential values for which the schema has an empty object type
that is intended, because that value cant exactly be encoded (unless its stringified to {} but that seems pointless to me?)
There was a problem hiding this comment.
Why? The schema should never have an empty object.
| builder.schema = new CredentialSchema(CredentialSchema.essential()); | ||
| builder.subject = { | ||
| fname: 'John', | ||
| emptyObject: {}, |
There was a problem hiding this comment.
There should be a similar test for an empty array.
| const flattened = {}; | ||
| const temp = flatten(obj) as object; | ||
| for (const k of Object.keys(temp)) { | ||
| const tempKeys = Object.keys(temp).filter((key) => typeof temp[key] !== 'object' || !isEmptyObject(temp[key])); |
There was a problem hiding this comment.
The following for loop is going to iterate over keys of temp. Rather than iterating again, move these checks inside the loop.
Signed-off-by: Samuel Hellawell <sshellawell@gmail.com>
No description provided.