【问题标题】:Jsonschema2pojo error with creating a list of objects with class name as "S"创建类名为“S”的对象列表时出现 Jsonschema2pojo 错误
【发布时间】:2014-08-17 08:45:24
【问题描述】:

我正在尝试从 json 模式生成 POJO。

问题:如果我将类名设为“s”,则会引发错误。

插件执行出错:执行目标 org.jsonschema2pojo:jsonschema2pojo-maven-plugin:0.4.0:generate failed: String index out of range: 0 -> [Help 1]

我尝试过使用maven插件以及http://www.jsonschema2pojo.org/

<groupId>org.jsonschema2pojo</groupId>
    <artifactId>jsonschema2pojo-maven-plugin</artifactId>
    <version>0.4.0</version>

在生成 pojo 时两者都会出错。

其他观察:它适用于其他字母。
如果它不是数组类型,那么普通对象也可以,但不能作为数组

架构的小摘录如下:

 { 
  "type": "object",
  "id": "http://jsonschema.net/abc",
  "required": true,
  "description": "Some description",
  "properties": {
  "s": {
          "type": "array",
          "id": "http://jsonschema.net/abc/s",
          "required": true,
          "items": {
            "type": "object",
            "id": "http://jsonschema.net/price/abc/0/",
            "required": true,
            "description": "sales price object of an item",
            "properties": {
               "ip": {
                "type": "number",
                "id": "http://jsonschema.net/price/p/s/0/value",
                "required": true,
                "description": "some desc"
              }
             }
            }
    }
  }
}

有人遇到过类似的问题/已知的错误吗?有解决办法吗?

【问题讨论】:

    标签: json jsonschema jsonschema2pojo


    【解决方案1】:

    代码有问题。 Issue 提出并关闭 - 在插件版本 0.4.5 中验证。

    【讨论】:

      猜你喜欢
      • 2013-11-20
      • 2022-11-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-16
      • 2012-07-23
      • 2018-08-10
      • 2022-10-13
      相关资源
      最近更新 更多