Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a list of objects with class name as “S” #213

Closed
niharikavy opened this issue Jul 7, 2014 · 3 comments
Closed

Creating a list of objects with class name as “S” #213

niharikavy opened this issue Jul 7, 2014 · 3 comments
Milestone

Comments

@niharikavy
Copy link

Problem : If I have the class name as "s", POJO is not generated for it.

I have tried using the maven plugin as well as http://www.jsonschema2pojo.org/
Both give errors while generating the pojos.

Error from plugin execution: Execution goal org.jsonschema2pojo:jsonschema2pojo-maven-plugin:0.4.0:generate failed: String index out of range: 0 -> [Help 1]

Other observations : It works for other letters.
If it is not an array type, then plain object works too, but not as an array

Sample excerpt of schema

{ 
  "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"
              }
             }
            }
    }
  }
}
@niharikavy niharikavy reopened this Jul 7, 2014
@joelittlejohn
Copy link
Owner

Looks like this is a problem with the inflector. Should be easy to add a special case for 's'.

@joelittlejohn joelittlejohn added this to the 0.4.5 milestone Jul 7, 2014
@tanarun1234
Copy link

I tried in version 0.5.0 and also in 1.1.1 , it still doesnt work. It does not geneate with 's' at the end .

My class name is ColleagueRelationships , but it just generated it as "ColleagueRelationship.java" . It removed 's' at the end from ColleagueRelationship(s)

@joelittlejohn
Copy link
Owner

@tanarun1234 yes, this is the expected behaviour. If you have an array of client relationships, then a single item within that array is assumed to be a client relationship.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants