APIkit 路由器无法解析 JSON 模式中的 $ref

APIkit Router can't resolve $ref in JSON schema

我正在使用 APIkit 路由器,并且有一个用于 posting 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" } } } } } } } } } } } }

当我 运行 应用程序和 post 该端点的对象时,我得到:

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 路由器是否有办法 handle/resolve json 模式 $ref?

恐怕目前没有办法做到这一点。随意贡献一个拉取请求或只是提出一个改进请求 here.