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

.Net: Prepare OpenAPI model collection properties to be modifiable. #9735

Conversation

SergeyMenshykh
Copy link
Member

@SergeyMenshykh SergeyMenshykh commented Nov 18, 2024

Motivation, Context and Description

Currently, OpenAPI model classes use a read-only version of list and dictionary types as types for collection properties. This is sufficient for now, but it could become a breaking change later when they need to be modifiable. In that case, they will have to be changed to non-read-only types - specifically, IList and IDictionary<TK, TV>. This PR changes all the collection properties to be modifiable by altering their types to IList and IDictionary<TK, TV>.

The RestApiSecurityRequirement model class is not completely freezeable at the moment and needs to be refactored to implement the IDictionary interface instead of inheriting from Dictionary. This change will allow for intercepting mutation calls and throwing an exception if the class is frozen.

Contributes to: #6884

@SergeyMenshykh SergeyMenshykh requested a review from a team as a code owner November 18, 2024 15:13
@SergeyMenshykh SergeyMenshykh self-assigned this Nov 18, 2024
@markwallace-microsoft markwallace-microsoft added the .NET Issue or Pull requests regarding .NET code label Nov 18, 2024
@markwallace-microsoft markwallace-microsoft added the kernel Issues or pull requests impacting the core kernel label Nov 19, 2024
@SergeyMenshykh SergeyMenshykh added the openapi Issues related to the OpenAPI function importer label Nov 19, 2024
@SergeyMenshykh SergeyMenshykh added this pull request to the merge queue Nov 19, 2024
Merged via the queue into microsoft:main with commit 8da553d Nov 19, 2024
15 checks passed
@SergeyMenshykh SergeyMenshykh deleted the change-type-of-openapi-model-collection-props branch November 19, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code openapi Issues related to the OpenAPI function importer
Projects
Status: Sprint: Done
Development

Successfully merging this pull request may close these issues.

3 participants