简体   繁体   English

Jsonschema2pojo错误,创建了类名为“ S”的对象列表

[英]Jsonschema2pojo error with creating a list of objects with class name as “S”

I am trying to generate POJOs from a json schema. 我正在尝试从json模式生成POJO。

Problem : If I have the class name as "s", it throws an error. 问题:如果我将类名设置为“ s”,则会引发错误。

Error from plugin execution: Execution goal org.jsonschema2pojo:jsonschema2pojo-maven-plugin:0.4.0:generate failed: String index out of range: 0 -> [Help 1] 插件执行错误:执行目标org.jsonschema2pojo:jsonschema2pojo-maven-plugin:0.4.0:generate失败:字符串索引超出范围:0-> [帮助1]

I have tried using the maven plugin as well as http://www.jsonschema2pojo.org/ 我已经尝试使用Maven插件以及http://www.jsonschema2pojo.org/

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

Both give errors while generating the pojos. 两者在生成pojos时都会出错。

Other observations : It works for other letters. 其他意见:它适用于其他字母。
If it is not an array type, then plain object works too, but not as an array 如果不是数组类型,那么普通对象也可以,但不能作为数组

Small excerpt of the schema is as below : 模式的小摘录如下:

 { 
  "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"
              }
             }
            }
    }
  }
}

Has someone faced a similar issue/known bug? 有人遇到过类似问题/已知错误吗? Is there a workaround? 有解决方法吗?

Was an issue with the code. 代码有问题。 Issue raised and closed - verified in plugin version 0.4.5. 发行募集和关闭-在插件版本0.4.5验证。

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

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