Skip to content

[Management] OpenAPI specs

Weidong Xu edited this page Aug 21, 2023 · 11 revisions

Automation in azure-rest-api-specs

In PR on azure-rest-api-specs or azure-rest-api-specs-pr, it is easy to enable the automation for management SDK.

As resource provider, one only need to ensure - repo: azure-sdk-for-java is added to swagger-to-sdk yaml section in readme.md, so that Java SDK automation is enabled. Here is the sample readme.md.

Reference

Use Python script

A Python script in Azure SDK for Java can help generate a management SDK from OpenAPI specs.

Please see Working with AutoRest for the installation of autorest CLI. It also requires the installation of Node.js 16 or above, Java 11 or above, and Python 3.

Python package PyYAML and requests is required to be installed, e.g. via pip3 install --upgrade PyYAML requests.

As an example, if the spec is resourcegraph, one can call below command line to generate Java management SDK for it.

python eng/mgmt/automation/generate.py --readme=resourcegraph

This will generate or update the SDK under sdk/resourcegraph/azure-resourcemanager-resourcegraph.

--tag option can be used if one wish to use a specific tag in spec readme.

Use pipeline

There is an internal pipeline java - lite generation - mgmt, which calls the above Python script and create pull request of the generated SDK.

It takes similar input parameters as the script, e.g. README variable for readme option, TAG variable for tag option.

Clone this wiki locally