Skip to content
This repository was archived by the owner on Jul 6, 2026. It is now read-only.

mgmt, make discriminator setter protected#2624

Merged
XiaofeiCao merged 4 commits into
Azure:mainfrom
XiaofeiCao:mgmt_discriminator_setter_protected
Mar 15, 2024
Merged

mgmt, make discriminator setter protected#2624
XiaofeiCao merged 4 commits into
Azure:mainfrom
XiaofeiCao:mgmt_discriminator_setter_protected

Conversation

@XiaofeiCao

Copy link
Copy Markdown
Contributor

fix #2574

For discriminator setters, we make them protected in case super class and child classes are in different packages.

code: 3849ab0
test: 0365751

@weidongxu-microsoft weidongxu-microsoft left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

wait a day for Redmond.

add Alan for review as well.

@XiaofeiCao XiaofeiCao requested a review from alzimmermsft March 14, 2024 07:58
Comment thread fluent-tests/Initialize-Tests.ps1 Outdated
Comment on lines +132 to +133
# polymorphic models in different packages
"--version=$AUTOREST_CORE_VERSION $FLUENTLITE_ARGUMENTS --regenerate-pom=false --input-file=https://github.com/Azure/azure-rest-api-specs/blob/64337ca106a20055b389f9652ea8cf942aa94252/specification/consumption/resource-manager/Microsoft.Consumption/stable/2023-11-01/consumption.json --java.namespace=com.azure.mgmtlitetest.consumption"
"--version=$AUTOREST_CORE_VERSION $FLUENTLITE_ARGUMENTS --regenerate-pom=false --input-file=https://github.com/Azure/azure-rest-api-specs/blob/64337ca106a20055b389f9652ea8cf942aa94252/specification/consumption/resource-manager/Microsoft.Consumption/stable/2023-11-01/consumption.json --java.namespace=com.azure.mgmtlitetest.consumption --generate-tests=false"

@XiaofeiCao XiaofeiCao Mar 14, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Model mock test seems having trouble identifying the right child class:
https://dev.azure.com/azure-sdk/public/_build/results?buildId=3595400&view=logs&j=ca395085-040a-526b-2ce8-bdc85f692774&t=738c417a-4a48-5620-b571-4f9e77e0bfd2&l=3290

@org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        ModernReservationRecommendation model = BinaryData.fromString(
            "{\"kind\":\"legacy\",\"properties\":{\"scope\":\"uewmrswnjlxuzrhw\",\"location\":\"sxjb\",\"lookBackPeriod\":1129684980,\"instanceFlexibilityRatio\":40.48269,\"instanceFlexibilityGroup\":\"dohzjq\",\"normalizedSize\":\"ucoig\",\"recommendedQuantityNormalized\":38.62258,\"meterId\":\"2668484c-c47e-440c-9b15-69e796f1b9db\",\"term\":\"nwfepbnwg\",\"costWithNoReservedInstances\":{\"currency\":\"jgcgbjbgdlfgtdys\"},\"resourceType\":\"flq\",\"totalCostWithReservedInstances\":{\"currency\":\"q\"},\"netSavings\":{\"currency\":\"jrwdkqz\"},\"firstUsageDate\":\"2021-01-23T02:59:42Z\",\"skuProperties\":[{\"name\":\"iunjxdf\",\"value\":\"ntkwcegy\"},{\"name\":\"lbnseqac\",\"value\":\"vpilg\"},{\"name\":\"oq\",\"value\":\"gmditgueiookjbs\"},{\"name\":\"rtdtpdelq\",\"value\":\"slmot\"}],\"skuName\":\"bnfxofvc\"},\"etag\":\"irazftxejwabmd\",\"tags\":{\"kyqltqsrogt\":\"mvcopexcmjurbuhh\",\"ysidfvclgl\":\"wkffdjkt\"},\"location\":\"fuijtkbus\",\"sku\":\"gsfikayiansha\",\"id\":\"ujtjiqxfz\",\"name\":\"j\",\"type\":\"ttvwkpqh\"}")
            .toObject(ModernReservationRecommendation.class);
}

Disabling generated mock test.

@XiaofeiCao XiaofeiCao merged commit 5e8bd8e into Azure:main Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

all client, "setKind" cannot be accessed in model of different package

4 participants