riku
2022-06-09 9867f6d5c5bccfe52b878c344c536905dd6b309e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package cn.flightfeather.supervision.common.api2word.utils;
 
import com.fasterxml.jackson.core.JsonProcessingException;
 
import java.util.Map;
 
 
/**
 * @author : ivenhan
 * @date : 2020/10/16
 */
public class RequestUtils {
 
    public static void validateRequestKey(Map<String, Map> content) throws JsonProcessingException {
        Map<String, Map> applicationJSON = content.get("application/json");
        if (applicationJSON == null) {
            throw new JsonProcessingException("content字段 缺少 application/json 字段") {};
        }
 
        Map<String, Map> schema = applicationJSON.get("schema");
        if (schema == null) {
            throw new JsonProcessingException("content字段 application/json 缺少 schema 字段") {};
        }
 
        if (schema.get("type") == null) {
            throw new JsonProcessingException("content字段 application/json 字段 schema 字段 缺少 type字段") {};
        }
    }
}