Validating HTTP Requests in Azure Functions
Validating HTTP Requests in Azure Functions
HTTP Request from Client
Blob Input Binding
/schemas/scheduleSchema.json
Sa mple JSON Schema
{
"defi nitions": {},
"$s chema": " chema#",
"title": "Scheduled Flight Schema",
"requi red": [
"fl i ghtNo",
"departing",
"a rri vi ng",
...
],
"properties": {
"fl i ghtNo": {
"$i d": "#/properties/flightNo",
"type": "s tri ng",
"ti tl e": "The Flightno Schema",
"default": "",
"exa mples": [
"456"
]
}
...
}
}
POST /Schedule
{
"flightNo": "RA01",
"departing": "CYUL",
"arriving": "KLAX",
"codeshares": [{
"partner": "Delta",
"flightNo": "123"
}],
"tailnumber": "N74656",
"scheduled": 1553559808,
"revised": 1553559808
}
HTTP Trigger Function
Read HTTP Request Stream and parse to JObject
Read Schema Stream and Parse to JSchema
Validate Request against Schema using
Newtonsoft.Json.Schema's IsValid() method
Process Valid Request and store flight in Table
When To Use
Pros and Cons
- Non-trivial JSON validations
- JSON format is known ahead of time
- Low to medium traffic loads
- Handles complex JSON contracts
- Schema is hard to modify by hand
- Potential issues at large scale due to blob
stream retrieved on every call
- Can generate schema for existing contract
For details, code samples, and more, click here.
Written by Marc Roussy / / @marcroussy
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- understanding json schema
- serialize and deserialize json c
- json or javascript object notation is a lightweight text
- how to convert pdf to json from uploaded file for pdf to
- supplementary material for bimodal modelling of source
- create schema from json string
- building an azure mobile app client
- exploiting and preventing deserialization vulnerabilities
- json deserialization exploitation owasp
- data collection at the edge
Related searches
- azure sql vs azure sql database
- making requests esl
- making requests in english
- companies accepting donation requests online
- python requests get example
- python requests post form data
- python requests send form data
- python requests send file
- python requests post file
- python requests post file upload
- python requests multipart form
- requests post python