amazon-web-services - AWS API Gateway 的 JSON 架构验证错误
问题描述
API 和 AWS API 网关的新手。我今天开始涉足 JSON Schema 并为我的 API 调用构建了一个模式。
使用 AWS API Gateway 创建模型时出现以下错误
指定的模型无效:验证结果:警告:[],错误:[指定的模型架构无效,指定的模型架构无效]
下面是我的架构
{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"location": {
"type": "object",
"properties": {
"location_description": {
"type": "string"
},
"address": {
"$ref": "#/definitions/address"
}
}
},
"property": {
"type": "object",
"properties": {
"property_type": {
"type": "string"
},
"description": {
"type": "string"
},
"damages": {
"type": "array",
"items": {
"type": "string"
}
},
"location": {
"$ref": "#/definitions/location"
},
"policy": {
"$ref": "#/definitions/policy"
}
}
},
"phone": {
"type": "object",
"properties": {
"phone_number": {
"type": "string"
},
"phone_extension": {
"type": "string"
}
}
},
"party": {
"type": "object",
"properties": {
"name_prefix": {
"type": "string"
},
"first_name": {
"type": "string"
},
"middle_name": {
"type": "string"
},
"last_name": {
"type": "string"
},
"nameSuffix": {
"type": "string"
},
"date_of_birth": {
"type": "string"
},
"addresses": {
"type": "array",
"items": {
"$ref": "#/definitions/address"
}
},
"phone": {
"$ref": "#/definitions/phone"
},
"email_addresses": {
"type": "array",
"items": {
"type": "string"
}
},
"relation_to_insured": {
"type": "string"
},
"license": {
"$ref": "#/definitions/drivers_license"
},
"policy": {
"$ref": "#/definitions/policy"
}
}
},
"address": {
"type": "object",
"properties": {
"address_line": {
"type": "string"
},
"postal_code": {
"type": "string"
},
"country_code": {
"type": "string"
}
}
},
"policy": {
"type": "object",
"properties": {
"policy_type": {
"type": "string"
},
"policy_number": {
"type": "string"
},
"policy_effective_date": {
"type": "string"
},
"policy_expiration_date": {
"type": "string"
},
"carrier_name": {
"type": "string"
},
"is_primary_insurance": {
"type": "boolean"
}
}
},
"drivers_license": {
"type": "object",
"properties": {
"license_number": {
"type": "string"
},
"issuing_authority": {
"type": "string"
},
"country": {
"type": "string"
}
}
},
"vehicle": {
"type": "object",
"properties": {
"vin": {
"type": "string"
},
"make": {
"type": "string"
},
"model": {
"type": "string"
},
"year": {
"type": "string"
},
"license_plate": {
"type": "string"
},
"license_plate_country": {
"type": "string"
},
"use_purpose": {
"type": "string"
},
"used_with_permission": {
"type": "boolean"
},
"damages": {
"type": "array",
"items": {
"type": "string"
}
},
"claim": {
"$ref": "#/definitions/claim"
},
"policy": {
"$ref": "#/definitions/policy"
},
"current_location": {
"$ref": "#/definitions/location"
},
"vehicle_parties": {
"type": "array",
"items": {
"$ref": "#/definitions/vehicle_party"
}
}
}
},
"claim": {
"type": "object",
"properties": {
"claim_mumber": {
"type": "string"
},
"claim_adjudicator": {
"type": "string"
}
}
},
"participant": {
"type": "object",
"properties": {
"participant_name": {
"type": "string"
},
"participant_type": {
"type": "string"
}
}
},
"loss_event_report": {
"type": "object",
"properties": {
"report_type": {
"type": "string"
},
"report_number": {
"type": "string"
},
"reporter_name": {
"type": "string"
},
"report_detail": {
"type": "string"
}
}
},
"vehicle_party": {
"type": "object",
"properties": {
"vehicle_party_type": {
"type": "string"
},
"injury_details": {
"type": "string"
},
"is_ambulance": {
"type": "boolean"
},
"is_extracted_from_vehicle": {
"type": "boolean"
},
"is_thrown_from_vehicle": {
"type": "boolean"
},
"is_medical_beneficiary": {
"type": "boolean"
},
"medical_vendor": {
"type": "string"
},
"party": {
"$ref": "#/definitions/party"
}
}
},
"injured_party": {
"type": "object",
"properties": {
"injury_details": {
"type": "array",
"items": {
"type": "string"
}
},
"party": {
"$ref": "#/definitions/party"
}
}
},
"insured_party": {
"type": "object",
"properties": {
"party": {
"type": {
"$ref": "#/definitions/party"
}
},
"policy": {
"type": {
"$ref": "#/definitions/policy"
}
}
}
},
"third_party": {
"type": "object",
"properties": {
"party_type": {
"type": "string"
},
"party": {
"$ref": "#/definitions/party"
}
}
}
},
"type": "object",
"required": [
"loss_event_id"
],
"properties": {
"loss_event_id": {
"type": "string"
},
"nature_of_incident": {
"type": "string"
},
"date_of_loss": {
"type": "string"
},
"injury_involved": {
"type": "boolean"
},
"number_of_impacts_felt": {
"type": "integer"
},
"description": {
"type": "string"
},
"fatality": {
"type": "boolean"
},
"loss_event_location": {
"$ref": "#/definitions/location"
},
"damaged_property": {
"$ref": "#/definitions/property"
},
"injured_party": {
"type": "object",
"properties": {
"injury_details": {
"type": "array",
"items": {
"type": "string"
}
},
"party": {
"$ref": "#/definitions/party"
}
}
},
"witnesses": {
"type": "array",
"items": {
"$ref": "#/definitions/party"
}
},
"other_vehicles": {
"type": "array",
"items": {
"$ref": "#/definitions/vehicle"
}
},
"insured_vehicles": {
"type": "array",
"items": {
"$ref": "#/definitions/vehicle"
}
},
"claims": {
"type": "array",
"items": {
"$ref": "#/definitions/claim"
}
},
"reports": {
"type": "array",
"items": {
"$ref": "#/definitions/loss_event_report"
}
},
"third_parties": {
"type": "array",
"items": {
"$ref": "#/definitions/third_party"
}
}
}
}
解决方案
推荐阅读
- openvms - openvms 创建没有版本扩展名的文件(;1 等)
- c# - 在命名空间中找不到 System.Text.Json.JsonReaderException
- php - Laravel 5.8 并不总是更新新编写的代码
- spring-boot - 动态启动和关闭 KafkaListener 只是为了在会话开始时加载以前的消息
- python - 横幅仅适用于某些帐户
- c - C 文件未针对覆盖进行检测,错误的 expr 节点类型
- c++ - 在 C/C++ 中将 ASCII 转换为 unicode 字符串(无 API)
- firebase - Firebase 云数据库规则 - 如何仅在用户 id 与对象中的键匹配的地方检索数据?
- python - 获得整数循环和的最有效方法是什么?
- types - 什么时候需要使用类型注解?