Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #6400
Closed
Open
Issue created May 22, 2020 by Administrator@rootContributor0 of 6 checklist items completed0/6 checklist items

[BUG] [Java] Empty object property not working correctly

Created by: spacether

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

When defining a schema that looks like this:

components:
  SomeObject:
    type: object
    properties:
      empty_map:
        type: object
        additionalProperties: false

We would expect to only accept this payload: {"empty_map": {}} But our code ends up accepting javascript objects with any values and any number of key value pairs.

@sebastien-rosset

openapi-generator version

Master branch

OpenAPI declaration file content or url

See the above example

Command line used for generation

any generator this came up in python-experimental in https://github.com/OpenAPITools/openapi-generator/pull/6290

Steps to reproduce

Generate a model for the above schema and check the validations in that model

Related issues/PRs
Suggest a fix

When this condition is seen (property schema of type object with no properties and additionalProperties: False) in Java we need to set the maxItems for this property to 0.

Assignee
Assign to
Time tracking