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

Incorrect generation for list of nullable objects #131

Closed
Tetraquark opened this issue May 14, 2021 · 1 comment · Fixed by #132
Closed

Incorrect generation for list of nullable objects #131

Tetraquark opened this issue May 14, 2021 · 1 comment · Fixed by #132
Labels
bug Something isn't working
Milestone

Comments

@Tetraquark
Copy link
Collaborator

I got schema like this:

    BlogPermissionsRoles:
      type: object
      additionalProperties:
        type: array
        items:
          type: string
          nullable: true

And the generator makes the wrong type for this scheme:

kotlin.collections.Map<kotlin.String, kotlin.collections.List<kotlin.String>>

Should be nullable kotlin.String inside List.

@Tetraquark Tetraquark added the bug Something isn't working label May 14, 2021
@Alex009 Alex009 added this to the 0.14.3 milestone May 14, 2021
@Tetraquark Tetraquark linked a pull request May 14, 2021 that will close this issue
@Tetraquark
Copy link
Collaborator Author

Tetraquark commented May 14, 2021

It looks like there are no ways to fix it inside moko-network-generator. So, the way to work around this problem is to declare a schema in the specification using oneOf operator:

BlogPermissionsRoles:
  type: object
  additionalProperties:
    type: array
    items:
      oneOf:
        - type: null
        - type: string

Check issue from OpenAPITools project for more info: OpenAPITools/openapi-generator#5180

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

Successfully merging a pull request may close this issue.

2 participants