Skip to content

Use ModelReaderWriter for Azure.Search.Documents#51558

Merged
ShivangiReja merged 15 commits intoAzure:mainfrom
sbomer:searchMRW
Aug 4, 2025
Merged

Use ModelReaderWriter for Azure.Search.Documents#51558
ShivangiReja merged 15 commits intoAzure:mainfrom
sbomer:searchMRW

Conversation

@sbomer
Copy link
Copy Markdown
Contributor

@sbomer sbomer commented Jul 29, 2025

Updates to use the ModelReaderWriter option in autorest.md,
and updates generated code and references to it.

This required an additional fix to work around incorrect use of
the codegen attributes:

  • Some models were generated with the same C# class,
    causing a race condition when the generator tried to
    write the same file twice.
  • This uses remove-model to remove the old versions
    of these models. Some generated code has been moved
    into custom classes to ensure we keep the mapping of
    the old and new model name to the same C# type on
    the deserialization path.
  • Uses CodeGenSerialization attribute to include
    generated deserialization code for bufferSize, which
    was defined by the old model.

This should fix the merging introduced by #12302
and identified as a problem in #12303.

@m-nash PTAL

Copilot AI review requested due to automatic review settings July 29, 2025 21:07
@sbomer sbomer requested review from a team and ShivangiReja as code owners July 29, 2025 21:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

@github-actions github-actions bot added Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. Search labels Jul 29, 2025
@github-actions
Copy link
Copy Markdown

Thank you for your contribution @sbomer! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jul 29, 2025

API Change Check

APIView identified API level changes in this PR and created the following API reviews

Azure.Search.Documents

@jsquire jsquire closed this Jul 30, 2025
@jsquire jsquire reopened this Jul 30, 2025
@sbomer sbomer closed this Jul 30, 2025
@sbomer sbomer reopened this Jul 30, 2025
Some models were generated with the same C# class,
causing a race condition when the generator tried to
write the same file twice.

This uses `remove-model` to remove the old versions
of these models. Some generated code has been moved
into custom classes to ensure we keep the mapping of
the old and new model name to the same C# type on
the deserialization path.

Uses `CodeGenSerialization` attribute to include
generated deserialization code for bufferSize, which
was defined by the old model.
@sbomer
Copy link
Copy Markdown
Contributor Author

sbomer commented Jul 31, 2025

@ShivangiReja @m-nash PTAL, I think this is ready to go.

This class is now generated
@sbomer sbomer requested review from a team and jsquire as code owners August 4, 2025 17:48
Copy link
Copy Markdown
Member

@m-nash m-nash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MRW changes look good

@sbomer sbomer requested a review from ShivangiReja August 4, 2025 20:12
@ShivangiReja ShivangiReja merged commit a7c6c66 into Azure:main Aug 4, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. Search

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants