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

WIP on new format changes #39817

Merged
merged 7 commits into from
Nov 9, 2023
Merged

WIP on new format changes #39817

merged 7 commits into from
Nov 9, 2023

Conversation

m-nash
Copy link
Member

@m-nash m-nash commented Nov 7, 2023

Contributing to the Azure SDK

Please see our CONTRIBUTING.md if you are not familiar with contributing to this repository or have questions.

For specific information about pull request etiquette and best practices, see this section.

@azure-sdk
Copy link
Collaborator

azure-sdk commented Nov 7, 2023

API change check

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

System.Net.ClientModel

{
bool implementsJson = model is IJsonModel<T>;
bool isValid = (format == ModelReaderWriterFormat.Json && implementsJson) || format == "W";
bool isValid = (format == "J" && implementsJson) || format == "W";
Copy link
Member

@annelo-msft annelo-msft Nov 8, 2023

Choose a reason for hiding this comment

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

Curious: would it be valid to do

Suggested change
bool isValid = (format == "J" && implementsJson) || format == "W";
bool isValid = (format == ModelReaderWriterOptions.Json.Format && implementsJson) || format == ModelReaderWriterOptions.Json.Format;

Asking for two reasons:

  • To see if I'm understanding how this works correctly
  • Because if we can, I think that'd be preferable to avoid "magic numbers" type errors

Copy link
Member Author

Choose a reason for hiding this comment

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

We would need to duplicate the constants in all libraries since all libraries will have models which will need to compare against these values.

This is one of the "downsides" to removing the ModelReaderWriterFormat, but it removes ambiguity around the conceptual formats wire and data and the concrete data interchange formats json, xml, etc.

@m-nash m-nash marked this pull request as ready for review November 8, 2023 20:22
@m-nash m-nash merged commit 005c17c into feature/modelReaderWriter Nov 9, 2023
@m-nash m-nash deleted the mnash-format branch November 9, 2023 00:35
azure-sdk pushed a commit to azure-sdk/azure-sdk-for-net that referenced this pull request Nov 22, 2023
…zure#39478)

* initial move to separate model reader writer in System.Net.ClientModel

* update api

* update doc settings for readme

* address pr feedback

* first cut at readme / changelog

* fix perf issue in helper methods

* add perf for srcgen

* address feedback

* update IModel to have a GetWireFormat

* update api

* update ci

* remove GetOptions

* WIP on new format changes (Azure#39817)

* wip on new format changes

* more tweaks to the API

* impl tweaks

* address feedback

* update api

* fix tests

* address feedback

* rename based on feedback (Azure#39885)

* Remove wire (Azure#40021)

* remove wire

* Update sdk/core/Azure.Core/tests/common/Internal/ModelReaderWriterHelper.cs

Co-authored-by: Anne Thompson <[email protected]>

* revert nullability since azure core tests don't support this right now

---------

Co-authored-by: Anne Thompson <[email protected]>

* Rename package (Azure#40030)

* rename package

* comment out bad test

* feedback

* more feedback

* update basic sample

* remove next steps

* update docs

* address feedback

* remove unused frozen code

* address feedback

* address additional feedback

* update ci.yml

* move file inside mrw folder

* Add exception documentation

* move helper file

* update comment

* readme feedback

* follow static field convention

* remove unecessary interlock

* add azure sdk analyzers back

* throw when cancelled

* remove unused #if

* remove azureicon

* update readme

* fix package icon

* remove unnecessary conditions

---------

Co-authored-by: Anne Thompson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants