Orbit Framework 2.0.0
A high-performance asynchronous C++20 HTTP server framework.
Loading...
Searching...
No Matches
Validation.hpp
Go to the documentation of this file.
1#pragma once
4#include <vector>
5#include <string>
6
7namespace orbit::middleware {
8
13enum class JsonType {
14 STRING,
15 NUMBER,
16 BOOLEAN,
17 OBJECT,
18 ARRAY
19};
20
26 std::string name;
28 bool required = true;
29};
30
41routing::Middleware validate_json(const std::vector<SchemaField>& schema);
42
43} // namespace middleware
routing::Middleware validate_json(const std::vector< SchemaField > &schema)
Returns a middleware that parses and validates a JSON request body.
JsonType
Enumeration of JSON data types.
Definition Validation.hpp:13
Definition HttpRequest.hpp:19
std::function< bool(http::HttpRequest &, std::shared_ptr< http::ResponseWriter >)> Middleware
Definition Router.hpp:19
Represents a field in a validation schema.
Definition Validation.hpp:25
std::string name
Definition Validation.hpp:26
bool required
Definition Validation.hpp:28
JsonType type
Definition Validation.hpp:27