I am using the ValidationRule table but have a lot of endpoints. I found that the moment that I load more than 1956 validation rules into the ValidationRule table, the /metadata page disappear. These validation rules are simple IsAuthenticated rules.
Please include the full context when reporting issues as I wont have a chance to know what the error is without anything to go on. It’s also not clear what “disappears” means, does the /metadata page return an empty response? only a partial html page, the full html page? If it does are the errors in the JS Console?
Basically please include anything else that can be helpful for someone else to try and identify what the issue is from a description.
I browse to the https://mywebsiteaddresshere/metadata. It comes back with a 200 response but the response is totally empty. There are no errors in the JS console. If I remove a single entry (Any entry) out of my ValidationRule Table, the /metadata page returns the correct endpoints. I initially throught that I had an invalid Type in the ValidationRule table where the Type does not exist, and therefore it broke, but it does not matter what I remove, as long as it is less than the specific number of entries. The /ui route that goes to the API Explorer bring back all the endpoints as per normal. We are using version 8.4.0 of ServiceStack. What does SS do in the /metadata pages if it encounters an invalid Type name in ValidationRule table ?
I don’t see how Type Validation rules would affect the /metadata page which essentially is generating a static html page. You’ll need to check to see your error logs to see if that shows anything. If it also happens during development, try running it in a debugger to see if you can catch any Exceptions or if your App has other handlers interfering with the metadata page.
Try putting a breakpoint in ProcessRequestAsync
and debugging to see if it’s able to generate the entire page without Exceptions.
I see that there were a typo in a Validator. How do we get errors back on invalid Types or invalid Validators or invalid Fields etc. out of the ValidationRule table. I ran the project in debug mode and did not see errors coming back
Did you add the Validation Rule using the UI?
No, straight to the database. We have a use case where we are setting the validations from a database script.
You’re writing unvalidated rules straight to the DB? You should really be calling the ModifyValidationRules
API to add them.
Either way here’s the validation that’s performed when adding validation rules:
You’ll want to do something similar in whatever you’re using to add them.
I will do so. So there is nothing validating the Field or the Validator. So if a field get’s removed from the database, the validation will fail, or if the Validator is wrong. It will then be safest to add that using your ModifyValidationRules api.
What happens if there are Duplicate rule types. I added ValidationRules using the admin-ui and it allows duplicate HasRoles records etc. however, these does not seem to work as it will only apply the first rule for HasRoles for that Type that it encounters.