Page MenuHomePhabricator

time data values are not validated when saved via api
Closed, ResolvedPublic

Description


Version: master
Severity: normal

Details

Reference
bz48965

Related Objects

StatusAssignedTask
OpenNone
ResolvedLydia_Pintscher
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
Resolvedadrianheine
ResolvedNone
Resolvedadrianheine
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
Resolvedadrianheine
DeclinedNone
DeclinedNone

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 1:42 AM
bzimport set Reference to bz48965.
bzimport added a subscriber: Unknown Object (MLST).
aude created this task.May 30 2013, 10:21 AM
aude added a comment.May 30 2013, 10:23 AM

I am allowed to save in the api (via wbcreateclaim) the following:

datavalue: {
value: {
time: "+00000001936-15-08T00:00:00Z",
timezone: 0,
before: 0,
after: 0,
precision: 11,
calendarmodel: "http://www.wikidata.org/wiki/Q12138"
},
type: "time"

http://www.wikidata.org/wiki/Q12138 is not a valid calendar model. It should be http://www.wikidata.org/entity/Q1985727.

This should be validated when the claim gets saved and return an error if the data value is not valid.

As it does get saved currently, we then see an error in the UI on an item page in the snak view:

"The value does not comply with the property's definition.
The value's data value type "ununserializable" does not match the property's data type's data value type "time"."

hmm... yeah, that's a tough one. On the one hand, do we really want to restrict it too much?

I would say that the error message is not too good. It should actually be "The data is saved with an unknown calendar model, to which we do not know how to translate to".

And then the saved data in proleptic gregorian could still be displayed.

I want to ask if we click on "http://www.wikidata.org/entity/Q1985727" we find error 404 so i think it should changes to something better like "
http://www.wikidata.org/wiki/Q12138" I mean don't remove restrictions, change it!

aude added a comment.May 30 2013, 1:24 PM

@amir we have a patch for supporting /entity/QXXX in apache. It should work soon.

@Denny it seems any arbitrary url or string can be put as calendar model. bots will go astray and have a potential mess.

I think it's best to have validation checked during save, so the api user has a chance to get it "right". Not sure about hard-coding the calendar models though. If they could be configurable and more flexible, that would be nice.

Related URL: https://gerrit.wikimedia.org/r/67962 (Gerrit Change I6990983ef0c0cad7c9d4f271bdf803902b94230b)

Related URL: https://gerrit.wikimedia.org/r/68150 (Gerrit Change I8916062971114d6bc3188dd4f0322c28cc54403e)

https://gerrit.wikimedia.org/r/68150 (Gerrit Change I8916062971114d6bc3188dd4f0322c28cc54403e) | change APPROVED and MERGED [by jenkins-bot]

https://gerrit.wikimedia.org/r/67962 (Gerrit Change I6990983ef0c0cad7c9d4f271bdf803902b94230b) | change ABANDONED [by Daniel Kinzler]

Related URL: https://gerrit.wikimedia.org/r/68152 (Gerrit Change I72d6b6d890718c07006c306c254479ce0789067e)

Related URL: https://gerrit.wikimedia.org/r/68397 (Gerrit Change Ib3e7b16c203d08008d7465859af0e1e7f940db14)

https://gerrit.wikimedia.org/r/68397 (Gerrit Change Ib3e7b16c203d08008d7465859af0e1e7f940db14) | change ABANDONED [by Daniel Kinzler]

Change 68152 merged by jenkins-bot:
(bug 49264, bug 48965) validate time format.

https://gerrit.wikimedia.org/r/68152