Skip to content

Usage of maxProperties not possible #1665

@bsoaressimoes

Description

@bsoaressimoes

Hello,

I tried to generate pojo using the maxProperties field on an object of type object, but it seems not handled at all in jsonschema2pojo plugin.
As a workaround we could use maxItem instead.

The problem with this solution is the fact that maxItem should be applied on Array while maxProperties is dedicated to objects.
So the json we declare is wrong.

Do you plan to add the maxProperties behavior in the plugin?

In case you need my schema is:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "Some Id",
  "type": "object",
  "properties":
  {
    "product":
    {
      "description": "Some description",
      "type": "string"
    },
    "attr":
    {
      "description": "Some attribute",
      "type": "object",
      "existingJavaType": "java.util.Map<String,String>",
      "patternProperties":
      {
        "^.*$":
        {
          "type": "string"
        }
      },
      "maxProperties":3,
    }
  },
  "required": [ "product" ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions