Skip to content

[BUG][rust] oneOf array enums produce invalid syntax for generated object types #23278

Description

@rgroothuijsen
Description

This is a continuation of #21599 which fixed arrays in enums for primitive types, but syntax errors still arise for generated types as pointed out in this comment. Instead of enum values like ArrayVecString(Vec<String>), it will produce values like ArrayVecmodels::TestObject(Vec<models::TestObject>), where the first set of double colons produces the problem.

openapi-generator version

7.21.0

OpenAPI declaration file content or url
openapi: 3.1.0
info:
  title: oneOf with object arrays
  description: Support object types in oneOf array enums.
  version: 1.0.0
components:
  schemas:
    ObjectArrays:
      type: object
      properties:
        Options:
          oneOf:
            - type: array
              items:
                $ref: '#/components/schemas/TestObject'
            - type: array
              items:
                $ref: '#/components/schemas/TestArray'
    TestObject:
      type: object
      properties:
        test:
          type: string
    TestArray:
      properties:
        test:
          type: array
          items:
            type: string
Steps to reproduce

Run the Rust client generator with default settings and the above YAML file.

Suggest a fix

Since I'm already looking into this, I'll create a PR for it.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions