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

[Automation] Generate Fluent Lite from deviceprovisioningservices# #21149

Closed

Conversation

azure-sdk
Copy link
Collaborator

[Automation] Generate Fluent Lite from deviceprovisioningservices#

@check-enforcer
Copy link

check-enforcer bot commented May 4, 2021

This pull request is protected by Check Enforcer.

What is Check Enforcer?

Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass.

Why am I getting this message?

You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged.

What should I do now?

If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows:
/check-enforcer evaluate
Typically evaulation only takes a few seconds. If you know that your pull request is not covered by a pipeline and this is expected you can override Check Enforcer using the following command:
/check-enforcer override
Note that using the override command triggers alerts so that follow-up investigations can occur (PRs still need to be approved as normal).

What if I am onboarding a new service?

Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment:
/azp run prepare-pipelines
This will run a pipeline that analyzes the source tree and creates the pipelines necessary to build and validate your pull request. Once the pipeline has been created you can trigger the pipeline using the following comment:
/azp run java - [service] - ci

@timtay-microsoft
Copy link
Member

For additional context here, the Device Provisioning Service control plane swagger has been GA for some time now, but we've never published any Java control plane SDK (track 1 or track 2), so this would be the first.

This work comes on the heels of the same work for .NET which can be seen here

@weidongxu-microsoft
Copy link
Member

/azp run prepare-pipelines

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@weidongxu-microsoft
Copy link
Member

weidongxu-microsoft commented May 6, 2021

Currently Java is in core release stage, therefore the code need to be merged a few days later (and with some changes to the pom file, as e.g. azure-core/azure-core-test/azure-identity version will be updated).

@weidongxu-microsoft
Copy link
Member

/azp run java - deviceprovisioningservices - ci

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Comment on lines 93 to 94
<source>9</source>
<target>9</target>
Copy link
Member

Choose a reason for hiding this comment

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

SDK is for Java8.


@Test
@DoNotRecord(skipInPlayback = true)
public void CreateAndDelete() {
Copy link
Member

Choose a reason for hiding this comment

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

Follow Java convention, else build will fail.

@Azure Azure deleted a comment from azure-pipelines bot May 10, 2021
@timtay-microsoft
Copy link
Member

@weidongxu-microsoft The generated code is running into some "Path too long" issues around a few classes:

sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/implementation/SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionImpl.java
sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/fluent/models/SharedAccessSignatureAuthorizationRuleAccessRightsDescriptionInner.java

Is there some way to shorten these class names when generating this managed library?

@timtay-microsoft
Copy link
Member

/azp run java - deviceprovisioningservices

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@weidongxu-microsoft
Copy link
Member

weidongxu-microsoft commented May 11, 2021

@timtay-microsoft

Yes, we can, via directive in swagger (for java only) or some optional parameter in codegen.

But is this name correct in the first place? SharedAccessSignatureAuthorizationRule[AccessRightsDescription] (it is the first time I saw [ ] in model name)?
https://github.com/Azure/azure-rest-api-specs/blob/master/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2020-03-01/iotdps.json#L2132-L2169

Could you verify the name is correct? Any suggestion for shorter name? I can add it to directive.

<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-test</artifactId>
<version>2.0.0-beta.1</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-test;current} -->
Copy link
Member

@weidongxu-microsoft weidongxu-microsoft May 11, 2021

Choose a reason for hiding this comment

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

It would be better not to include this.

If you really really need this, you need to put it in a profile, as this azure-resourcemanager-test is not released to maven.

    <profile>
      <id>azure-mgmt-sdk-test-jar</id>
      <activation>
        <property>
          <name>!maven.test.skip</name>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>com.azure.resourcemanager</groupId>
          <artifactId>azure-resourcemanager-test</artifactId>
          <version>2.0.0-beta.1</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-test;current} -->
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>

import java.time.temporal.ChronoUnit;
import java.util.List;

public class DeviceProvisioningResourceManagementTestBase extends ResourceManagerTestBase

Choose a reason for hiding this comment

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

Again, I don't think you need this.

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha. I had been modeling my test code on the Key Vault Resource Management SDK, but is there a more recent control plane SDK that I should model my test code on?

@timtay-microsoft
Copy link
Member

@timtay-microsoft

Yes, we can, via directive in swagger (for java only) or some optional parameter in codegen.

But is this name correct in the first place? SharedAccessSignatureAuthorizationRule[AccessRightsDescription] (it is the first time I saw [ ] in model name)?
https://github.com/Azure/azure-rest-api-specs/blob/master/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2020-03-01/iotdps.json#L2132-L2169

Could you verify the name is correct? Any suggestion for shorter name? I can add it to directive.

I hadn't noticed that before, but the model names do seem a bit odd. I'll follow up with the service team to see if we can fix these names. If so, then we won't need any special directives here.

@timtay-microsoft
Copy link
Member

@weidongxu-microsoft the service team that owns the control plane swagger here asserts that the strange naming of that autorest model came from autorest itself since their swagger is not hand-written. That means we can either push for autorest swagger generation to not do this strange naming, or just override the name locally for this SDK via directives. I'm guessing that the latter would be easier, but the former would prevent other language SDKs from hitting this same issue in the future. Considering the swagger was generated, do you still see this as an swagger bug? Or would you be fine leaving the swagger as is and use directives here to fix the naming?

@weidongxu-microsoft
Copy link
Member

weidongxu-microsoft commented May 18, 2021

@timtay-microsoft

I don't think there is any "official" tool for service to auto-generate the control-plane swagger. However if the tool really is maintained by Microsoft (maybe ADL? that one is in preview or even before preview), we could at least notify them.

@timtay-microsoft
Copy link
Member

@weidongxu-microsoft I'd like to wrap this up, so is it possible for you to just use directives to simplify the name to "SharedAccessSignatureAuthorizationRule"? I've also implemented all the tests for this SDK now based on the tests in the digital twins resource manager like you suggested.

@timtay-microsoft
Copy link
Member

/azp run java - deviceprovisioningservices

@Azure Azure deleted a comment from azure-pipelines bot May 27, 2021
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@weidongxu-microsoft
Copy link
Member

@timtay-microsoft Swagger PR here Azure/azure-rest-api-specs#14565

@timtay-microsoft
Copy link
Member

Closing this PR in favor of #21938 which captures the new generated layer with the slight renaming discussed above

@azure-sdk azure-sdk deleted the fluent-lite-generation-875089 branch October 19, 2023 00:20
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