-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated Claim Interface #226
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Review Checklist
- [na] Tested changes manually
- Checked accidental architectural/style changes
- Reviewed entire diff
- Unit tests
- [na] Documentation
- [na] Filenames and locations
PR Reviewer Comments
There are a number of places where you have to update this for unit tests to pass. You should see this in Travis.
src/Interfaces.ts
Outdated
@@ -9,12 +9,16 @@ export enum ClaimType { | |||
Work = 'Work', | |||
} | |||
|
|||
export interface StringToRecursiveObject { | |||
[key: string]: string | number | StringToRecursiveObject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might also need to be an array of items.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which may mean the key can be a number?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think to support the array we'd do
[key: string]: string | number | StringToRecursiveObject | ReadonlyArray<string | number | StringToRecursiveObject >
Can the array be of any of those types @krobi64?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you saying that the claim itself can be an array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I'm saying one of the attributes inside the claim may be an array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok then I think @lautarodragan option should work, assuming that the array can be of numbers, strings, and/or objects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not the claim, but attributes inside it could (is that it @krobi64?).
I guess something like this would be a valid claim
:
{
name: 'A Study in Scarlet',
author: 'Arthur Conan Doyle',
tags: ['detective', 'novel', 'detective'],
dateCreated: '1886-01-01T00:00:00.000Z',
datePublished: '1887-01-01T00:00:00.000Z',
stuff: [ { something: true, somethingElse: 42 } ],
nestedStuff: [ { reallyComplex: { someNestedProp: 42 } } ],
},
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A simpler alternative would be
export interface StringToRecursiveObject {
readonly [key: string]: number | string | unknown // maybe add array here too
}
That would allow programmatic access to first-level children of claim as strings or numbers, but no other level, nor mutation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Changes were made to fix unit tests + handle Array
PR Process - PR Review Checklist
Release
Semantic release is enabled for this repository. Make sure you follow the right commit message convention.
We're using semantic-release's default — Angular Commit Message Conventions.
Description of Changes
Resolves #227