-
Notifications
You must be signed in to change notification settings - Fork 19
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
Activemodel not validating object throws wrong error #569
Comments
For some reason, the value of "ident" column from EPP request ("CHE-XXXXX") is not set on EPP contact:update. As I understand the code misses registry/app/models/epp/contact.rb Line 187 in d3b1a23
|
@vohmar Also I need business rules, describing a case, when a user sends EPP contact:update request with the following part: |
Rule 1: ident cannot be updated |
error code for invalid update request trying to change ident data 2308 "Data management policy violation" + validation rule based specification ie. other possible specifications |
Given that "ident" column cannot be updated, perhaps it's worth mentioning that in https://github.com/internetee/registry/blob/master/doc/epp/contact.md? |
Ident modification must be completely retested. |
all the validation applied to contact create must apply to contact update as well (at the resulting object) |
@vohmar
Should it still allow updating Also, what is the expected behaviour for the case when:
|
Why https://github.com/internetee/registry/blob/master/app/models/contact.rb#L32 |
@artur-beljajev ident_country_code was not initially required if the ident_type was set as birthday. Currently the country_code is always required and thus it should also be validated - so this is a bug. |
No 6: error messages still need improvements case1: contact:update ident - 2308: Invalid ident. Only ident type and country can be updated in case of invalid ident. Please create new contact object to update ident code. case2: contact:update ident type/cc (ident data set validates) - 2308: Ident update is not allowed. Consider creating new contact object. |
№ 6: |
contact update: case1: ident data set validates on an existing contact object - update of ident data not allowed. Attempt to update results "2308: Ident update is not allowed. Consider creating new contact object." case2: ident data set is not valid on an existing contact object - update of ident_cc and ident_type is allowed in case the resulting data set validates At the same time the general principle of detecting actual change still applies - if update includes data that matches the data already in db (in reality nothing is changed) it is not considered as attempt to change data and cannot result in error. For example contact object with valid ident data set in registry |
|
Fixed, spec added |
I reverted your revert. See PR |
Expected return is Activemodel errors shown in EPP.
Contact object validation fails:
irb(main):009:0> a.validate
USER MSG: ACTIVEMODEL: Contact [ident] Required parameter missing - ident
USER MSG: ACTIVEMODEL: Contact [ident_type] is missing
USER MSG: ACTIVEMODEL: Contact [ident_type] Object status prohibits operation: ident_type of contact CID:XXXX:xxxx is invalid
USER MSG: ACTIVEMODEL: Contact [ident] Ident country code is not valid, should be in ISO_3166-1 alpha 2 format
USER MSG: ACTIVERECORD: Contact #117517 ["Ident Required parameter missing - ident", "Ident Ident country code is not valid, should be in ISO_3166-1 alpha 2 format", "Ident type is missing", "Ident type Object status prohibits operation: ident_type of contact CID:XXXX:xxxx is invalid"] []
=> false
When user wants to update that object over epp non clear error is thrown:
Request XML is
Response XML is
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
The text was updated successfully, but these errors were encountered: