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

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

Closed
6 tasks
spacether opened this issue May 22, 2020 · 0 comments
Closed
6 tasks

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

spacether opened this issue May 22, 2020 · 0 comments

Comments

@spacether
Copy link
Contributor

spacether commented May 22, 2020

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 #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.

@spacether spacether changed the title [BUG] [Java] Empty Object Property not working correctly [BUG] [Java] Empty object property not working correctly May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant