phenotips / remote-matching

Patient matching across applications
2 stars 2 forks source link

Remote-matching parser tolerates misformed requests #33

Open buske opened 9 years ago

buske commented 9 years ago

The parsing appears to be tolerant of deviations from the MME API in two ways:

1) Trailing commas appears to be tolerated, e.g.:

"features": [{...}, {...}, ]
                         ^

2) the "genes" property is allowed to be a string, rather than enforcing it as an object. E.g., the following is currently tolerated: {"gene": "SRCAP"}

while the following is currently required by the v1.0 spec: {"gene": {"id": "SRCAP"}}

This caused confusion while trying to test a request against another service. It validated against localhost, but caused errors against the other service.

(see #34)

sdumitriu commented 9 years ago

Trailing commas are allowed by the JS specification, but not by the official JSON specification, so that might be considered a bug. Although it might be considered the other way around, an imperfection in the old JSON specification, which should be rectified, but that won't happen anytime soon.

buske commented 9 years ago

Okay, I didn't realize it was allowed by JS. If it's easy to fix, I say we fix it to side with the JSON spec. If not, we can probably leave it and just resolved point 2).

allasm commented 9 years ago

I did not realize this was already being discussed in an issue in this repository and created a duplicate #34. The genetic part of the issue will be fixed there.