简体   繁体   English

边缘集合的 Arango 架构验证与 false additionalProperties 不起作用

[英]Arango schema validation for Edge collection with false additionalProperties not working

I am using ArangoDB schema validation released in 3.7 version.我正在使用 3.7 版本中发布的 ArangoDB 模式验证。 Schema validation happens as expected for Document collections.对于 Document 集合,架构验证按预期发生。 But for Edge collections following issue comes.但是对于Edge 集合,出现了以下问题。

  • Requirement of edge: The edge should have either id property or no properties at all (hence required key is not used), and no any other properties(hence additionalProperties is set to false).边的要求:边应该有id属性或根本没有属性(因此不使用required键),并且没有任何其他属性(因此additionalProperties设置为 false)。

I used the following schema and the edge instance.我使用了以下架构和边缘实例。 But the following edge instance cannot be created as the schema validation fails.但是由于架构验证失败,无法创建以下边缘实例。

Schema used:使用的架构:

{
  "message": "Schema validation error",
  "level": "strict",
  "rule": {
    "properties": {
      "id": {
        "type": "string"
      }
    },
    "additionalProperties": false
  }
}

Edge instance creation tried using ArangoDB Web Interface :尝试使用 ArangoDB Web 界面创建边缘实例:

  • _from: DocCollection1/t1 _来自:DocCollection1/t1
  • _to: DocCollection2/t2 _to: DocCollection2/t2
  • _key: e1 _key:e1
  • Document body:{}文档正文:{}

The edge can be created if I change additionalProperties to true , but it also enables to create edges with properties with any name, which I do not need.如果我将additionalProperties更改为true ,则可以创建边,但它也可以创建具有我不需要的任何名称的属性的边。

I have searched in Arango documentation and cannot figure out why the schema validation fails for this scenario in Edge collections.我在 Arango 文档中进行了搜索,但无法弄清楚为什么在 Edge 集合中的这种情况下架构验证失败。 Same scenario works fine in Document collections.相同的场景在文档集合中工作正常。

Environment : Single node, v3.7.2, Community Edition环境:单节点,v3.7.2,社区版

This was a bug that got fixed in 3.7.5:这是在 3.7.5 中修复的错误:

https://github.com/arangodb/arangodb/issues/12778 https://github.com/arangodb/arangodb/pull/12967 https://github.com/arangodb/arangodb/issues/12778 https://github.com/arangodb/arangodb/pull/12967

There doesn't seem to be a workaround for 3.7.4 and earlier versions unfortunately - adding _from explicitly as attribute doesn't help, I suppose because it's a special field which requires internal translation.不幸的是,似乎没有 3.7.4 及更早版本的解决方法 - 显式添加_from作为属性没有帮助,我想是因为它是一个需要内部翻译的特殊字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM