Using the sandbox, if I generate multiple errors, like using 911 for the CVV and 01/40 for the date, and 99999 for the zip code, the reply has only one error in it. With all three of those error generating values, it returns only "Postal code check failed." Is there some way to get all errors back in a single post? What is the point of the JSON errors object being an array if only one error is included?
Related
Just getting to grips with GO and loving it. I've come across a small issue and I can't seem to over come it.
I have an array of errors returning using validator.Validate. I have a POST endpoint which has two required fields. If none of these fields are in the body, I will get back an array of errors stating these are required.
My Issue However, If I send over the incorrect data type on one of these (string), it will validate the input one by one. For example:
This is working as intedned with nothing sent in the body
Image1
And below, is sending over name and testingvalidation as an integer
Image2
How do I get my code to not just validate the one above? I noticed if the error is a type of json.UnmarshalTypeError then it will only return one error
DRF translation in my project just translates a part of messages not all of them.
Please see following images:
In following image, I haven't sent any data for Post request and I've received all error messages translated.
But in the following image, I've sent some part of data and sent another part invalid.
As you see, it has not translated message.
summary:
DRF translates This field is required, but it does not translate Ensure this field has no more than {max_length} characters.
Technical issue with etrade API.
I am constructing a trailing stop sell-to-close order with the following preview in Sandbox:
"{"PreviewOrderRequest":{"orderType":"OPTN","clientOrderId":"27099010699269ea2bee","Order":[{"allOrNone":"false","priceType":"TRAILING_STOP_CNST","orderTerm":"GOOD_FOR_DAY","marketSession":"REGULAR","trailPrice":".15","stopPrice":0,"Instrument":[{"Product":{"symbol":"MSFT","securityType":"OPTN","callPut":"CALL","expiryYear":"2021","expiryMonth":"9","expiryDay":"24","strikePrice":"290"},"orderAction":"SELL_CLOSE","orderedQuantity":"10","quantity":"10"}]}]}}"
However, in response, I am receiving the following error message:
"{"Error":{"code":7,"message":"You did not specify a stop price. Please fill in the missing information and resubmit your order."}}"
As you can see, I am setting the "stopPrice":0 in the order object. I put zero "0" since this is the value used in several examples from the documentation:
https://apisb.etrade.com/docs/api/order/api-order-v1.html#/definitions/OrderDetail
And I tried it as both a number and string: "stopPrice":"0" without success.
Is there a different field/value to set or format/configuration to make this work?
The obvious question is whether 0 is a valid value.
I'd be surprised if it is, but it's easy to check.
I'm writing a graphQL API using Apollo server and I would like to know is there a way to add an error to the errors array returned in the response, without throwing an actual error and failing the entire resolver.
In my code I iterate an input array and in case I encounter an unsupported item, I wish to add it to the errors array returned in the response, while still returning data for the other valid items.
Please advise if and how I can do that.
Thanks in advance.
I'm having problems trying to make angular run all the validations of an input at once.
Here is a jsfiddle example of my problem http://jsfiddle.net/carpasse/GDDE2/
if you type 1 character on the email input you get this "The minimum lenght is 3." error message
and is not until you type 2 more characters than you get the other error message "This is not a valid email."
Does anybody know how to make angular show both error messages at the same time??
Thanks a lot in advance
You problem is not that all the validators are not being run - they are!
Remember that the way these validations work is by passing the view values through a pipeline of transformation functions, which can also specify the validity of the value.
The problem is that the min length validator passes undefined down the pipeline if it is not valid and that the email validator says that undefined is a valid email address!
Try creating your own validation directive that says that undefined is not a valid email address and you will find both errors are showing: http://jsfiddle.net/eKfj3/