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

Fix for Enum collections types described as string collections #1846

Merged
merged 3 commits into from
Sep 15, 2022

Conversation

andrueastman
Copy link
Member

This PR closes #1845

It fixes a bug where a property that is a collection of an Enum would be incorrectly evaluated to the string type in the CodeDom.
This led to some missing models (as the enum would potentially not be referenced) as well as models having the List<string> leading to loss of the strongly typed enum.

In summary the changes include: -

  • Update the CreateCollectionModelDeclaration to check if the schema contains an Enum to allow the CreateModelDeclarations method to do its job.
  • Add tests to validate the scenarios

Generation changes can be viewed at the links below.

src/Kiota.Builder/KiotaBuilder.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/KiotaBuilder.cs Outdated Show resolved Hide resolved
src/Kiota.Builder/KiotaBuilder.cs Outdated Show resolved Hide resolved
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

82.5% 82.5% Coverage
0.0% 0.0% Duplication

@andrueastman andrueastman merged commit 78d77c7 into main Sep 15, 2022
@andrueastman andrueastman deleted the fixEnumProperties branch September 15, 2022 15:27
@andrueastman
Copy link
Member Author

Thanks @baywet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enum collection properties are represented as strings
2 participants