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

Cannot generate Maps via additionalProperties #272

Closed
JapuDCret opened this issue Jan 27, 2023 · 3 comments · Fixed by #273
Closed

Cannot generate Maps via additionalProperties #272

JapuDCret opened this issue Jan 27, 2023 · 3 comments · Fixed by #273
Labels
bug Something isn't working released stale

Comments

@JapuDCret
Copy link
Contributor

Describe the bug

additionalProperties are not correctly mapped to a Map, instead they create an empty wrapper object AnonymousSchemaX.

How to Reproduce

Use a schema like

components:
  messages:
    metadata:
      payload:
        $id: SongMetaData
        type: object
        properties:
          tags:
            description: Tags
            additionalProperties:
              type: string
          stats:
            description: Stats
            additionalProperties:
              type: integer
              format: int64
          interprets:
            description: Interprets
            additionalProperties:
              $ref: '#/components/schemas/Interpret'
  schemas:
    Interpret:
      type: object
      properties:
        name:
          description: Interpret name
          type: string

Expected behavior

The previously mentioned schema should generate a class structure that can represent the following JSON:

{
  "tags": {
    "tag1": "string",
    "tag2": "string"
  },
  "stats": {
    "stat1": 0,
    "stat2": 0
  },
  "interprets": {
    "some-key1": {
      "name": "string"
    },
    "some-key2": {
      "name": "string"
    }
  }
}
@JapuDCret JapuDCret added the bug Something isn't working label Jan 27, 2023
@github-actions
Copy link

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

JapuDCret added a commit to JapuDCret/java-spring-template that referenced this issue Jan 27, 2023
JapuDCret added a commit to JapuDCret/java-spring-template that referenced this issue Jan 27, 2023
JapuDCret added a commit to JapuDCret/java-spring-template that referenced this issue Jan 27, 2023
JapuDCret added a commit to JapuDCret/java-spring-template that referenced this issue May 19, 2023
JapuDCret added a commit to JapuDCret/java-spring-template that referenced this issue May 19, 2023
JapuDCret added a commit to JapuDCret/java-spring-template that referenced this issue May 19, 2023
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@github-actions github-actions bot added the stale label May 28, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 26, 2023
Tenischev added a commit that referenced this issue Oct 11, 2023
* feat: Add support for additionalProperties (#272)

* fix: Map imports (#272)

* fix: Allow additionalProperties=false (#272)

* test: Extend test case for boolean (#272)

* test: Extend test case for oneOf (#272)

* rework: Remove else-branch to check value (#272)

* update from master, fix order of imports and tests

* fix case when `additionalProperties = true`

---------

Co-authored-by: Semen <tenischev.semen@gmail.com>
@asyncapi-bot
Copy link
Contributor

🎉 This issue has been resolved in version 1.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants