Marco Breveglieri replied to Marco Breveglieri's topic in MARS-Curiosity REST LibraryHi Andrea, thank you very much for all the information provided, really far more than I hoped for. I only need to verify the presence of some mandatory fields and the range of some values, nothing complicated. My question originated from the fact that I am used to validation mechanisms embedded in other frameworks, such as ASP.NET MVC, and so I wanted to check if there was something ready to use inside MARS that would provide the same benefits, e.g. field attributes or similar. I think the second implementation is a good balance between clarity and effectiveness so I will implement my validation code following that sample. Thanks again for your great support! Marco.
Marco Breveglieri posted a topic in MARS-Curiosity REST LibraryHi, I am (happily) using MARS in a Delphi REST server application. The client has faculty of posting new resource data to the server, and I use a plain record structure to collect it leveraging the [BodyParam] attribute, as seen in the "ToDoList" demo bundled with the product. Now I have to apply some validation and return the expected Bad Request error when some field have been set to an invalid value. Is there some ready-to-use attribute or tool in MARS Curiosity in order to cover this use case? If not, is there any preferrable way to handle and return one or more validation errors? Thanks in advance for any suggestion, and thanks a lot to Andrea for the really good and useful library!