我使用APIkit路由器并有一个发布InvoiceGroups
的端点。在RAML中,我指定了InvoiceGroups.schema.json(以及相关的模式)。
这是架构的简化版本:
{
"type" : "object",
"id" : "urn:jsonschema:com:vatit:blaze:dto:InvoiceGroups",
"properties" : {
"waterline" : {
"type" : "string",
"description" : "Paging waterline; will be populated by the server when requesting a paged list of invoices"
},
"items" : {
"type" : "array",
"description" : "List of invoice groups",
"items" : {
"type" : "object",
"id" : "urn:jsonschema:com:vatit:blaze:dto:InvoiceGroup",
"properties" : {
"invoices" : {
"type" : "array",
"items" : {
"type" : "object",
"id" : "urn:jsonschema:com:vatit:blaze:dto:Invoice",
"properties" : {
"expenseType" : {
"type" : "object",
"id" : "urn:jsonschema:com:vatit:blaze:dto:ExpenseType",
"description" : "Expense type info",
"properties" : {
"externalName" : {
"type" : "string",
"description" : "Descriptive name for the expense type in the external system. This is not a required field"
},
"externalId" : {
"type" : "string",
"required" : true,
"description" : "External expense type Id - a unique identifier to the expense type in an external system"
},
"id" : {
"type" : "integer",
"description" : "Internal Blaze Id"
},
"dragonId" : {
"type" : "integer",
"description" : "References the expense type id in Dragon - this is usually mapped by system administrators"
}
}
},
"items" : {
"type" : "array",
"description" : "List of invoice items - for itemised invoices.",
"items" : {
"type" : "object",
"id" : "urn:jsonschema:com:vatit:blaze:dto:InvoiceItem",
"properties" : {
"expenseType" : {
"type" : "object",
"$ref" : "urn:jsonschema:com:vatit:blaze:dto:ExpenseType",
"description" : "Expense type info"
}
}
}
}
}
}
}
}
}
}
}
}
当我运行应用程序并将对象发布到该端点时,我得到:
Schema validation failed: /items/1/invoices/0/items/0/expenseType: domain: $ref resolving; keyword: N/A; message: failed to get content from URI; exception-class: "org.eel.kitchen.jsonschema.main.JsonSchemaException"; exception-message: "FATAL ERROR: domain: $ref resolving; keyword: N/A; message: cannot handle scheme; scheme: \"urn\"; uri: \"urn:jsonschema:com:vatit:blaze:dto:ExpenseType#\""; uri: "urn:jsonschema:com:vatit:blaze:dto:ExpenseType#"
APIkit路由器是否有办法处理/解析json架构$ ref?