Proper place to validate JSON in an ASP.NET core app
I am building an ASP.NET Core 10.0 web-app using .NET's MVC model w/ Kestrel to serve it. The app will deploy on an Azure VM. It's a personal project, therefore, I decided to go with Cosmos DB as the database. Azure offered me a free tier DB with enough storage and IOP/s (they call them RU/s) to scale up while the App gains traffic. I have never used a NoSQL DB before, but I like the idea of storing JSON documents as data. What I am having a tough time deciding, and what I would like to know, is at what point should the validation be performed? As middleware, the frontend or should I hook it in the pipe between the two? Currently the only method of validation that I can think of is using the JSON Schema spec to write a schema for the JSON I want to store. Other than writing the validation myself, is that my only option?
I am building an ASP.NET Core 10.0 web-app using .NET's MVC model w/ Kestrel to serve it. The app will deploy on an Azure VM. It's a personal project, therefore, I decided to go with Cosmos DB as the database. Azure offered me a free tier DB with enough storage and IOP/s (they call them RU/s) to scale up while the App gains traffic. I have never used a NoSQL DB before, but I like the idea of storing JSON documents as data.
What I am having a tough time deciding, and what I would like to know, is at what point should the validation be performed? As middleware, the frontend or should I hook it in the pipe between the two?
Currently the only method of validation that I can think of is using the JSON Schema spec to write a schema for the JSON I want to store. Other than writing the validation myself, is that my only option?