16

Is there a way currently to validate objects in Azure functions using something similar to Data Annotations and Model State in the MVC framework? Or what is the standard approach to data validation and error response in Functions?

tokyo0709
  • 1,897
  • 4
  • 28
  • 49
  • 1
    Here's an article that provides examples of validating Azure Functions HTTP triggers with the FluentValidation library: https://www.tomfaltesek.com/azure-functions-input-validation/ – Tom Faltesek Jun 27 '19 at 21:21

1 Answers1

10

This mechanism doesn't exist today, so you need to handle this validation yourself, but this would be a great feature.

We have an issue tracking this here: https://github.com/Azure/azure-webjobs-sdk/issues/1199, please feel free to comment and upvote!

Fabio Cavalcante
  • 12,328
  • 3
  • 35
  • 43
  • I followed that github link and tried out Fluent Validation https://fluentvalidation.net/ It works quire nicely – Sarah Sep 17 '20 at 00:52