-
Notifications
You must be signed in to change notification settings - Fork 7
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
SDK-1133: Retrieve the same attribute with different constraints #76
base: development
Are you sure you want to change the base?
SDK-1133: Retrieve the same attribute with different constraints #76
Conversation
b58e5f6
to
364d04c
Compare
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.
Looks good, let's wait to test on the example project before merging though 👍
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 there's a breaking change in here (although it's unlikely anyone would be instantiating a profile themselves)
lib/yoti/data_type/base_profile.rb
Outdated
attr_reader :attributes | ||
def attributes | ||
@attributes.map { |key, value| [key, value[0]] }.to_h | ||
end | ||
|
||
# | ||
# @param [Hash{String => Yoti::Attribute}] profile_data |
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.
Should this constructor support both [Hash{String => Array<Yoti::Attribute>}]
and [Hash{String => Yoti::Attribute}]
for backwards compatibility?
Or perhaps
[Hash{String => Yoti::Attribute}]
andArray<Yoti::Attribute>
? (When a hash is provided, process into@attributes_list
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.
I don't think @attributes can be a Hash of Objects any more? It's always set with a Hash-of-list?
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.
Oh, wait this isn't a constructor.
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.
Sorry, I meant this comment to correspond with line 18
I was thinking you could provide a Array<Yoti::Attribute>
and process this into both a [Hash{String => Array<Yoti::Attribute>}]
and [Hash{String => Yoti::Attribute}]
(for backwards compatibility).
(but you'd also have to support [Hash{String => Yoti::Attribute}]
being passed into the constructor as before, so a bit fiddly)
spec/yoti/data_type/profile_spec.rb
Outdated
@@ -18,7 +18,7 @@ | |||
"#{Yoti::Attribute::AGE_OVER}21" => 'false' } | |||
|
|||
profile_data = profile_values.map do |name, value| | |||
[name, Yoti::Attribute.new(name, value, {}, {})] | |||
[name, [Yoti::Attribute.new(name, value, {}, {})]] |
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 indicates a breaking change (although a low risk one)
364d04c
to
5f4ece1
Compare
5f4ece1
to
f244351
Compare
4cc8e3e
to
c51e6f8
Compare
9f6e449
to
ad18e8c
Compare
c51e6f8
to
e047a36
Compare
Add get_all_attributes_by_name(string):array to return a list of
attributes sharing the same attribute name.
TODO