- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.1k
[Management] OpenAPI specs
        Rujun Chen edited this page Aug 20, 2021 
        ·
        1 revision
      
    - npm 3+ in your PATH
- gulp 3+ installed globally (npm install -g gulp)
- 
Finalize your OpenAPI (a.k.a. Swagger) specs in azure-rest-api-sepcs repo. 
- 
Add your entry in the Java SDK gulp file. See Add an entry to gulp file. 
- 
Find out the client-runtime version & AutoRest version to use. See Which version should I use?. 
- 
Generate the code by executing gulp codegen --projects <service name> --autorest <autorest version> 
- 
Add a pom.xml file using another service as a template 
- 
Add your service to the parent pom. 
If you open gulpfile.js you can see a mapping defined on the top:
var mappings = {
    "compute": {
        "dir": "azure-mgmt-compute",
        "source": "arm-compute/2016-03-30/swagger/compute.json",
        "package": "com.microsoft.azure.management.compute",
        "args": "-FT 1"
    },
    ...
}Add yours in it:
var mappings = {
    ...
    "<simple name>": {
        "dir": "azure-mgmt-<service>",
        "source": "<path to OpenAPI JSON>",
        "package": "com.microsoft.azure.management.<service>",
        "args": "-FT 1",
        "fluent": "true"
    },
    ...
}Fields explained:
- <simple name> - this is the unique identifier user types in command line to generate the code, in lower case
- <service> - the name of your service, in lower case
- <path to OpenAPI JSON> - the relative path to your specs file in azure-rest-api-specs repo.
- fluent - Use false if there's no fluent interface built on top of the AutoRest generated code. This is usually true for management libraries, and false for data plane libraries.
Here is a table of compatible runtime and AutoRest:
| Runtime version | AutoRest nightly version | Remarks | 
|---|---|---|
| 1.0.0-beta1 | AutoRest 0.15.0 | This is the last released version where ARM libraries are still simply auto-generated. Please use this if you expect your customers to use auto-generated resource, storage, compute, or network libraries. Danger: there have been many bug fixes since we released this in March. This can be outdated and we are deprecating it. | 
| 1.0.0-beta2 | 0.17.0-Nightly20160707 | |
| 1.0.0-beta3 | 0.17.0-Nightly20161004 | 
- Frequently Asked Questions
- Azure Identity Examples
- Configuration
- Performance Tuning
- Android Support
- Unit Testing
- Test Proxy Migration
- Azure Json Migration
- New Checkstyle and Spotbugs pattern migration
- Protocol Methods
- TypeSpec-Java Quickstart
- Getting Started Guidance
- Adding a Module
- Building
- Writing Performance Tests
- Working with AutoRest
- Deprecation
- BOM guidelines
- Release process
- Access helpers