-
Notifications
You must be signed in to change notification settings - Fork 4k
Reorder child resource output #596
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
Conversation
Hi @DeepakRajendranMsft, I'm your friendly neighborhood Azure Pull Request Bot (You can call me AZPRBOT). Thanks for your contribution! TTYL, AZPRBOT; |
@@ -21,10 +21,13 @@ namespace Microsoft.Azure.Commands.Network.Models | |||
|
|||
public class PSBackendAddressPool : PSChildResource | |||
{ | |||
[JsonProperty(Order = 1)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does making every property Order=1 change the behavior? Do you have a test for the new serialization?
@markcowl However, we want the output to be BackendAddressPools : [
By default, the order of a property is 0 and when you serialize an object in json, it serializes in the ascending order. So, we are now changing the Jsonproperties of the derived classes to be 1, so that the base class properties get printed first. (see http://www.newtonsoft.com/json/help/html/JsonPropertyOrder.htm) Regarding test, since this is only a formatting change and not a change to the output object, i am not sure what kind of test i can write. (i can write to a stream and read from it, but that seems to be overkill since we are not changing the property value but only the order) |
I just realized that the better way to fix this is in PSchildResource rather than the individual derived classes. Will update the PR shortly. |
It seems like writing the object to and reading from a memory stream would be the best way to test this. I won't hold up the PR on this, though, please just add this test the next time you are updatign tests oc cmdlets. |
@markcowl Thanks, will add a test to verify the serialization later. Also, this PR is good as it is. Changing on the base class doesnt work. So we are good to merge now. Regarding reading and verifying from stream, we should have a bigger conversation with xrp folks since we dont have any tests which verify the formal.xml files either. |
@DeepakRajendranMsft This is just protection from regression - you'll need to make sure to do this with each derived class from this point forward. |
Reorder child resource output
Reordering Child resource output.
This is a just "good to have" in the current cycle, so doesnt need to be merged if it is going to delay the msi release.