IIRC @Valid isn't a Spring annotation but a JSR-303 annotation (which is the Bean Validation standard). What it does is it basically checks if the data that you send to the method is valid or not (it will validate the scriptFile for you).
@Valid annotation is commonly used within the Bean Validation API scope. It’s primarily employed to enable form validation or validation of model objects. //Below are my pojo classes public class ...
Here, @Valid is javax.validation.Valid, and @Validated is org.springframework.validation.annotation.Validated. The docs for the latter say Variant of JSR-303's Valid, supporting the specification of validation groups. Designed for convenient use with Spring's JSR-303 support but not JSR-303 specific. which doesn't help much because it doesn't tell exactly how it's different. If at all. Both ...
This is why you're getting the "Unexpected token '<'" error, because the HTML is not valid JSON. To fix this issue, you need to check what the server is sending back and make sure it's returning a JSON object.
While it makes sense here to have answers that show problems caused by other kinds of valid syntax, this is an example where the version of Python used causes the syntax not to be valid. This question, fundamentally, is about code becoming invalid because of other parts of the code. Protected question.
When validating, you should always "think positive": ask for "what is valid", everything else is invalid. Testing against the (few) valid characters is much safer (and easier!) than all possible invalid ones.
How to fix SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not ...
Often, a 'valid number' means a Javascript number excluding NaN and Infinity, ie a 'finite number'. To check the numerical validity of a value (from an external source for example), you can define in ESlint Airbnb style :