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

Changes in https://github.com/microsoft/kiota/pull/3921 result in incrrorect generation of inline anyof and array enum types. #3935

Closed
andrueastman opened this issue Dec 19, 2023 · 2 comments · Fixed by #3937
Assignees
Labels
generator Issues or improvements relater to generation capabilities. type:bug A broken experience WIP
Milestone

Comments

@andrueastman
Copy link
Member

Latests generation at https://dev.azure.com/microsoftgraph/Graph%20Developer%20Experiences/_build/results?buildId=130660&view=logs&j=0c914960-8b50-5299-c9aa-dd3c9595168e&t=97dbd468-8cc6-5acc-f2af-de93eaf8bad9 fails due to changes in #3921

Referenced types of enum in an anyOf or array are incorrectly generated as inline types.

e.g. the reason property is generated as RejectPostRequestBody_reason.cs rather than a collection of micrososft.graph.rejectedReasons

requestBody:
        description: Action parameters
        content:
          application/json:
            schema:
              type: object
              properties:
                reason:
                  anyOf:
                    - $ref: '#/components/schemas/microsoft.graph.rejectReason'
                    - type: object
                      nullable: true
                callbackUri:
                  type: string
                  nullable: true
        required: true
@baywet
Copy link
Member

baywet commented Dec 19, 2023

Hi @andrueastman,
Thanks for reporting this.
Why would you expect the reason property to be a collection? It's not described as an array.
The fact that the type is getting inlined because of the change is concerning though.

@andrueastman
Copy link
Member Author

Thanks for clearing this up @baywet. The issue does seem to be with inlining.
I made the mistake of thinking it had to do with collections due to other examples I was looking at that met the criteria such as
acceptedModalities here.

requestBody:
        description: Action parameters
        content:
          application/json:
            schema:
              type: object
              properties:
                callbackUri:
                  type: string
                mediaConfig:
                  $ref: '#/components/schemas/microsoft.graph.mediaConfig'
                acceptedModalities:
                  type: array
                  items:
                    anyOf:
                      - $ref: '#/components/schemas/microsoft.graph.modality'
                      - type: object
                        nullable: true
                participantCapacity:
                  maximum: 2147483647
                  minimum: -2147483648
                  type: integer
                  format: int32
                  nullable: true
                callOptions:
                  anyOf:
                    - $ref: '#/components/schemas/microsoft.graph.incomingCallOptions'
                    - type: object
                      nullable: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
generator Issues or improvements relater to generation capabilities. type:bug A broken experience WIP
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants