balanced / balanced-api

Balanced API specification.
220 stars 72 forks source link

Some error messages in the error schema contain new lines (\n) #597

Open matin opened 10 years ago

matin commented 10 years ago

From https://github.com/balanced/balanced-api/blob/master/fixtures/_models/error.json#L109-L111

"The bank account was tokenized on a different marketplace than the one\nused for this request.",
"The card could not be validated -- either the card number or security code\nmay be wrong.",
"The card is already associated with an account -- it cannot be associated\nagain.",
steveklabnik commented 10 years ago

Is this a particular problem?

matin commented 10 years ago

Are the API responses supposed to include JSON that has newlines in it?

steveklabnik commented 10 years ago

I wouldn't put them there today, but there's no inherent problem with it. Since we've already promised to people that this is what we return, we're stuck with it until the next major API revision.

matin commented 10 years ago

I doubt that's what we're actually returning today. I think the schema is not inline with reality. This looks to me like someone's editor screwed up.

description falls back to:

{
    "type": "string",
    "pattern": ".* Your request id is OHM[a-zA-Z0-9]*\\."
}

... so the scenarios would still pass and schema validates.

steveklabnik commented 10 years ago

Right, that'd pass anyway.

@matthewfl you wrote these originally. what do you think?

matthewfl commented 10 years ago

The error messages were originally derived off of what the api was supposedly producing.

What should happen is that we validate the error message as being the first part of the description, and then validate the request id part as being the last.