AWS API Gateway

时间:2018-10-31 01:13:38

标签: amazon-web-services aws-api-gateway jsonschema

API和AWS API Gateway的新功能。我今天开始涉猎JSON模式,并为我的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"
      }
    }
  }
}

0 个答案:

没有答案