Jump to content

Marco Breveglieri

Members
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

1 Neutral

About Marco Breveglieri

  • Birthday 07/04/1978

Technical Information

  • Delphi-Version
    Delphi 10.3 Rio

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Marco Breveglieri

    Best way to validate posted data and return validation errors

    Hi 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.
  2. Hi, 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!
×