diff --git a/documentation/sdkautomation/GenerateInputSchema.json b/documentation/sdkautomation/GenerateInputSchema.json new file mode 100644 index 000000000000..ccfebd87b568 --- /dev/null +++ b/documentation/sdkautomation/GenerateInputSchema.json @@ -0,0 +1,51 @@ +{ + "type": "object", + "properties": { + "dryRun": { + // If dryRun is true, generateScript is expected to parse readme.md + // and output the package list with package name and related readme.md. + // Should not run codegen at this time. + // ** Not supported yet ** + "type": "boolean" + }, + "specFolder": { + // Path to local spec folder. + "type": "string" + }, + "headSha": { + // Git head sha. + "type": "string" + }, + "headRef": { + // Git head ref. + // Format will be "refs/pull//merge" or "refs/heads/". + "type": "string" + }, + "repoHttpsUrl": { + // Spec repo url in https without auth. + "type": "string" + }, + "trigger": { + "$ref": "TriggerType#" + }, + "changedFiles": { + // Changed file list in spec PR. + "type": "array", + "items": { + "type": "string" + } + }, + "relatedReadmeMdFiles": { + // Related readme.md files that pending generation. + "type": "array", + "items": { + "type": "string" + } + }, + "installInstructionInput": { + // See #InstallInstructionScriptInput + "$ref": "InstallInstructionScriptInput#" + } + }, + "required": ["specFolder", "headSha", "headRef", "repoHttpsUrl", "trigger", "changedFiles", "relatedReadmeMdFiles"] +} diff --git a/documentation/sdkautomation/GenerateOutputSchema.json b/documentation/sdkautomation/GenerateOutputSchema.json new file mode 100644 index 000000000000..017685af2950 --- /dev/null +++ b/documentation/sdkautomation/GenerateOutputSchema.json @@ -0,0 +1,71 @@ +{ + "type": "object", + "properties": { + "packages": { + "type": "array", + "items": { + "$ref": "#/definitions/PackageResult" + } + } + }, + "required": ["packages"], + "definitions": { + "PackageResult": { + "properties": { + "packageName": { + // Name of package. Will be used in branch name and PR title. + // By default it's folder name of first entry in path. + "type": "string" + }, + "result": { + // Status of package. By default it's succeeded. + "type": "string", + "enum": ["failed", "succeeded", "warning"], + "default": "succeeded" + }, + "path": { + // List of package content paths. + // If the path points to a folder then + // all the content under the folder will be included. + "type": "array", + "items": { + "type": "string" + } + }, + "readmeMd": { + // List of related readmeMd of this package. + // Must provide this field if dryRun is true. + "type": "array", + "items": { + "type": "string" + } + }, + "changelog": { + "type": "object", + "properties": { + "content": { + // Content of changelog in markdown + "type": "string" + }, + "hasBreakingChange": { + // Does the new package has breaking change + "type": "boolean" + } + }, + "required": ["content"] + }, + "artifacts": { + "type": "array", + "items": { + "type": "string" + } + }, + "installInstructions": { + // See #InstallInstructionScriptOutput + "$ref": "InstallInstructionScriptOutput" + } + }, + "required": ["path"] + } + } +} diff --git a/documentation/sdkautomation/InitOutputSchema.json b/documentation/sdkautomation/InitOutputSchema.json new file mode 100644 index 000000000000..a2353494ccbd --- /dev/null +++ b/documentation/sdkautomation/InitOutputSchema.json @@ -0,0 +1,11 @@ +{ + "type": "object", + "properties": { + "envs": { + // Environment variable to be set in following scripts. + "additionalProperties": { + "type": "string" + } + } + } +} diff --git a/documentation/sdkautomation/InstallInstructionScriptInputSchema.json b/documentation/sdkautomation/InstallInstructionScriptInputSchema.json new file mode 100644 index 000000000000..c2dea969537c --- /dev/null +++ b/documentation/sdkautomation/InstallInstructionScriptInputSchema.json @@ -0,0 +1,35 @@ +{ + "$id": "InstallInstructionScriptInput", + "type": "object", + "properties": { + "packageName": { + // The package name. May be skipped if sdk automation don't know the info yet. + "type": "string" + }, + "artifacts": { + // List of artifact's path. May be skipped if sdk automation don't know the info yet. + "type": "array", + "items": { + "type": "string" + } + }, + "isPublic": { + // Is the download url public accessible. + // If it's false, the download command template will be + // az rest --resource -u "{URL}" --output-file {FILENAME} + "type": "boolean" + }, + "downloadUrlPrefix": { + // All the artifacts will be uploaded and user could access the artifact via + // a link composed by this prefix and artifact filename. + "type": "string" + }, + "downloadCommandTemplate": { + // Download command template. Replace {URL} and {FILENAME} to get the real command. + "type": "string" + }, + "trigger": { + "$ref": "TriggerType#" + } + } +} diff --git a/documentation/sdkautomation/InstallInstructionScriptOutputSchema.json b/documentation/sdkautomation/InstallInstructionScriptOutputSchema.json new file mode 100644 index 000000000000..1c4671b891ad --- /dev/null +++ b/documentation/sdkautomation/InstallInstructionScriptOutputSchema.json @@ -0,0 +1,17 @@ +{ + "$id": "InstallInstructionScriptOutput", + "type": "object", + "properties": { + "full": { + // Full version of install instruction will be shown in generated SDK PR. + // Should be in markdown format. + "type": "string" + }, + "lite": { + // Lite version of install instruction will be shown in generated SDK PR. + // Should be in markdown format. + "type": "string" + } + }, + "required": ["full"] +} diff --git a/documentation/sdkautomation/SpecConfigSchema.json b/documentation/sdkautomation/SpecConfigSchema.json new file mode 100644 index 000000000000..3245cf222fef --- /dev/null +++ b/documentation/sdkautomation/SpecConfigSchema.json @@ -0,0 +1,82 @@ +{ + "type": "object", + "properties": { + "sdkRepositoryMappings": { + // A mapping of SDK repository names to the names of the SDK repositories + // that all interaction should go to instead. + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "$ref": "#/definitions/SdkRepositoryConfig" + }, + { + "type": "string" + } + ] + }, + "propertyNames": { + // The property name is the sdk name identifier. + "type": "string" + } + }, + "overrides": { + // Override config for specific repository. + "type": "object", + "additionalProperties": { + "$ref": "#/" + }, + "propertyNames": { + // The property name is the sdk repo ref. + "$ref": "#/definitions/RepositoryName" + } + } + }, + "required": ["sdkRepositoryMappings"], + "definitions": { + "RepositoryName": { + // Reference to a repository on github. Could be or /. + // By default the is the same as the owner of the spec repo. + "type": "string" + }, + "SdkRepositoryConfig": { + "type": "object", + "properties": { + "mainRepository": { + // The repository that the final release PR will targeting. + "$ref": "#/definitions/RepositoryName" + }, + "mainBranch": { + // Base branch of codegen branches + "default": "master", + "type": "string" + }, + "integrationRepository": { + // The repository that hold generation branch, generation PR and integration branch. + // By default it's the same as mainRepository + "$ref": "#/definitions/RepositoryName" + }, + "secondaryRepository": { + // Codegen runs on this repository. + // By default it's the same as 'mainRepository' but it could be different. + "$ref": "#/definitions/RepositoryName" + }, + "secondaryBranch": { + // Codegen runs on this branch on secondaryRepository. + // By default it's the same as 'mainBranch' but it could be different. + "type": "string" + }, + "integrationBranchPrefix": { + // The prefix that will be applied to the beginning of integration branches + "type": "string", + "default": "sdkAutomation" + }, + "configFilePath": { + // Path to swagger-to-sdk config in sdk repo + "default": "swagger_to_sdk_config.json" + } + }, + "required": ["mainRepository"] + } + } +} diff --git a/documentation/sdkautomation/SwaggerToSdkConfigSchema.json b/documentation/sdkautomation/SwaggerToSdkConfigSchema.json new file mode 100644 index 000000000000..7b5034e5f0ba --- /dev/null +++ b/documentation/sdkautomation/SwaggerToSdkConfigSchema.json @@ -0,0 +1,286 @@ +{ + "type": "object", + "properties": { + "advancedOptions": { + // To keep backward compatibility, but will not list schema for old config options. + "properties": { + "createSdkPullRequests": { + // Should SDK Automation create PR or not. + "type": "boolean", + "default": true + }, + "closeIntegrationPR": { + // Should SDK Automation close integrationPR to reduce noise. + "type": "boolean", + "default": true + }, + "draftIntegrationPR": { + // Should SDK Automation create draft integrationPR to reduce noise. + "type": "boolean", + "default": true + }, + "generationCallMode": { + // If we have multiple related readme.md, should we call generation once with + // all the readme.md or should we call generation multiple times and one per readme.md. + "type": "string", + "enum": ["one-per-config", "one-for-all-configs"], + "default": "one-for-all-configs" + }, + "cloneDir": { + // SDK clone directory. By default it's name of sdk repo + "type": "string" + } + }, + "default": { + "createSdkPullRequests": true, + "closeIntegrationPR": true, + "draftIntegrationPR": true + } + }, + "initOptions": { + // Init the environment. Install dependencies. + "type": "object", + "properties": { + "initScript": { + // Script to init dependencies. + // Param: + // initInput.json: Not implemented. Placeholder for input arguments. + // initOutput.json: See #initOutput. + "$ref": "#/definitions/RunOptions" + } + }, + "default": {} + }, + "generateOptions": { + // Generate the SDK code. + "type": "object", + "properties": { + "generateScript": { + // Script to generate the SDK code. + // Param: + // generateInput.json: See #GenerateInput + // generateOutput.json: See #GenerateOutput + "$ref": "#/definitions/RunOptions" + }, + "preprocessDryRunGetPackageName": { + // If this options is set to true, generateScript will first run with + // "dryRun": true to get package name and related readme.md, + // then for each package, checkout the expected branch and launch generateScript. + "type": "boolean", + "default": false + }, + "parseGenerateOutput": { + // Will this script output to generateOutput.json. + // If not, default behavior will be applied that outcome will be + // detected automatically based on filename regex search. + "type": "boolean", + "default": true + } + }, + "default": { + "preprocessDryRunGetPackageName": false, + "parseGenerateOutput": false + } + }, + "packageOptions": { + // Get package folder and build / get changelog + "type": "object", + "properties": { + "packageFolderFromFileSearch": { + "oneOf": [ + { + // If this option is set to object, then package folder will be detected automatically. + // based on filename regex search. + // This options must be set to object if parseGenerateOutput is false. + "type": "object", + "properties": { + "searchRegex": { + // Search algorithm: + // For each changed file detected after generation + // PotentialPackageFolder = folder of changed file + // While PotentialPackageFolder is not root folder of sdk repo: + // If PotentialPackageFolder contains a file that matches the searchRegex: + // PackageFolder found, break + // Else: + // PotentialPackageFolder = parent folder of PotentialPackageFolder + "type": "string", + "format": "regex" + }, + "packageNamePrefix": { + // Prefix to be appended to packageName. + // By default packageName will be the folder name of packageFolder + "type": "string" + } + }, + "required": ["searchRegex"] + }, + { + // If this option is set to false, then package folder will be from generateOutput.json. + "const": false + } + ] + }, + "buildScript": { + // Build the generated sdk. + // Param: + // Package folder could be a list separated by space if it's from generateOutput.json. + "$ref": "#/definitions/RunOptions" + }, + "changelogScript": { + // Changelog generation and breaking-change detection. + // Param: + // Package folder could be a list separated by space if it's from generateOutput.json. + // Expected output from stdout/stderr: Changelog in markdown + "allOf": [ + { + "$ref": "#/definitions/RunOptions" + } + ], + "properties": { + "breakingChangeDetect": { + // If stdout or stderr matches this in output of changelog tool + // then we assume this SDK has breaking change. + "$ref": "#/definitions/RunLogFilterOptions" + } + } + }, + "breakingChangeLabel": { + // Label to be added in spec PR if breaking change is found + "type": "string" + } + }, + "default": {} + }, + "artifactOptions": { + "properties": { + "artifactPathFromFileSearch": { + "oneOf": [ + { + // If this option is set to object, then artifacts will be detected automatically + // based on filename regex search. + // This options must be set to object if parseGenerateOutput is false. + "type": "object", + "properties": { + "searchRegex": { + // Any file under package folder matching the searchRegex is package artifact. + "type": "string", + "format": "regex" + } + }, + "required": ["searchRegex"] + }, + { + // If this option is set to false, then package folder will be from generateOutput.json + "const": false + } + ] + }, + "installInstructionScript": { + // Generate install instruction that could be shown in spec PR comment (lite version) + // or in generated SDK PR (full version). + // If generateOutput.json contains installInstruction then this could be skipped. + // Param: + // installInstructionInput.json: See #InstallInstructionScriptInput . + // installInstructionOutput.json: See #InstallInstructionScriptInput . + "$ref": "#/definitions/RunOptions" + } + }, + "default": {} + } + }, + "definitions": { + "RunOptions": { + // Options to run a script and collect log. + "type": "object", + "properties": { + "path": { + // Script path related to repo root + "type": "string" + }, + "envs": { + // Extra environment variable to be passed to the script. + // By default the following envs will be passed: + // USER, HOME, PATH, SHELL, PWD (current directory), TMPDIR (dedicated temp folder) + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "logPrefix": { + // Prefix to be added to SDK Automation log. By default it would be filename of the script. + "type": "string" + }, + "stdout": { + // How should SDK Automation handle the script stdout stream + "allOf": [ + { + "$ref": "#/definitions/RunLogOptions" + } + ] + }, + "stderr": { + // How should SDK Automation handle the script stderr stream + "allOf": [ + { + "$ref": "#/definitions/RunLogOptions" + } + ], + "default": { + "scriptWarning": true + } + }, + "exitCode": { + "properties": { + // How should SDK Automation handle non-zero exitCode. + "showInComment": { + // Should we show this error in comment. + "type": "boolean", + "default": true + }, + "result": { + // If script has non-error exitCode how should we mark the script's result. + "type": "string", + "enum": ["error", "warning", "ignore"], + "default": "error" + } + }, + "default": { + "showInComment": true, + "result": "error" + } + } + }, + "required": ["path"] + }, + "RunLogOptions": { + // How should SDK Automation handle the log stream. + "showInComment": { + // Should we show this stream in comment. + "$ref": "#/definitions/RunLogFilterOptions" + }, + "scriptError": { + // If any line match, assume the script fails. + "$ref": "#/definitions/RunLogFilterOptions" + }, + "scriptWarning": { + // If any line match, assume the script warns. + "$ref": "#/definitions/RunLogFilterOptions" + } + }, + "RunLogFilterOptions": { + "oneOf": [ + { + // If line of log match this regex then hit + "type": "string", + "format": "regex" + }, + { + // If set to true, any line of log will hit + "type": "boolean" + } + ], + "default": false + } + } +} diff --git a/documentation/sdkautomation/sdk_customization.md b/documentation/sdkautomation/sdk_customization.md index 620ed6edfe57..a425d04862c5 100644 --- a/documentation/sdkautomation/sdk_customization.md +++ b/documentation/sdkautomation/sdk_customization.md @@ -109,87 +109,8 @@ This is type of file `./specificationRepositoryConfiguration.json` in swagger sp ``` #### SpecRepoConfig Schema -``` jsonc -{ - "type": "object", - "properties": { - "sdkRepositoryMappings": { - // A mapping of SDK repository names to the names of the SDK repositories - // that all interaction should go to instead. - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/SdkRepositoryConfig" - }, - "propertyNames": { - // The property name is the sdk name identifier. - "type": "string" - } - }, - "overrides": { - // Override config for specific repository. - "type": "object", - "additionalProperties": { - "$ref": "#/" - }, - "propertyNames": { - // The property name is the sdk repo ref. - "$ref": "#/definitions/RepositoryName" - } - }, - "required": [ - "sdkRepositoryMappings" - ] - }, - "definitions": { - "RepositoryName": { - // Reference to a repository on github. Could be or /. - // By default the is the same as the owner of the spec repo. - "type": "string" - }, - "SdkRepositoryConfig": { - "type": "object", - "properties": { - "mainRepository": { - // The repository that the final release PR will targeting. - "$ref": "#/definitions/RepositoryName" - }, - "mainBranch": { - // Base branch of codegen branches - "default": "master", - "type": "string" - }, - "integrationRepository": { - // The repository that hold generation branch, generation PR and integration branch. - // By default it's the same as mainRepository - "$ref": "#/definitions/RepositoryName" - }, - "secondaryRepository": { - // Codegen runs on this repository. - // By default it's the same as 'mainRepository' but it could be different. - "$ref": "#/definitions/RepositoryName" - }, - "secondaryBranch": { - // Codegen runs on this branch on secondaryRepository. - // By default it's the same as 'mainBranch' but it could be different. - "type": "string" - }, - "integrationBranchPrefix": { - // The prefix that will be applied to the beginning of integration branches - "type": "string", - "default": "sdkAutomation" - }, - "configFilePath": { - // Path to swagger-to-sdk config in sdk repo - "default": "swagger_to_sdk_config.json" - } - }, - "required": [ - "mainRepository" - ] - } - } -} -``` + +See [./SpecConfigSchema.json](https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/sdkautomation/SpecConfigSchema.json) ### SwaggerToSdkConfig This is type of file `./swagger_to_sdk_config.json` in sdk repo. @@ -205,6 +126,10 @@ The working folder of all the scripts is the __root folder of sdk repo__. }, "initOptions": { "initScript": { + // Script to init dependencies. + // Param: + // initInput.json: Not implemented. Placeholder for input arguments. + // initOutput.json: See #initOutput. "path": "./eng/tools/sdk_init" } }, @@ -244,7 +169,9 @@ The working folder of all the scripts is the __root folder of sdk repo__. "changelogScript": { "path": "./eng/tools/sdk_breaking_change", "breakingChangeDetect": "Breaking Change" - } + }, + + "breakingChangeLabel": "CI-BreakingChange-DotNet" }, "artifactOptions": { // Param: @@ -258,252 +185,8 @@ The working folder of all the scripts is the __root folder of sdk repo__. ``` #### SwaggerToSdkConfig Schema -``` jsonc -{ - "type": "object", - "properties": { - "advancedOptions": { - // To keep backward compatibility, but will not list schema for old config options. - "properties": { - "createSdkPullRequests": { - // Should SDK Automation create PR or not. - "type": "boolean", - "default": true - }, - "closeIntegrationPR": { - // Should SDK Automation close integrationPR to reduce noise. - "type": "boolean", - "default": true - }, - "generationCallMode": { - // If we have multiple related readme.md, should we call generation once with - // all the readme.md or should we call generation multiple times and one per readme.md. - "type": "string", - "enum": [ - "one-per-config", - "one-for-all-configs" - ], - "default": "one-for-all-configs" - } - } - }, - "initOptions": { - // Init the environment. Install dependencies. - "type": "object", - "properties": { - "initScript": { - // Script to init. - "$ref": "#/definitions/RunOptions" - } - }, - "required": [ - "initScript" - ] - }, - "generateOptions": { - // Generate the SDK code. - "type": "object", - "properties": { - "generateScript": { - // Script to generate the SDK code. - // Param: - // generateInput.json: See #GenerateInput - // generateOutput.json: See #GenerateOutput - "$ref": "#/definitions/RunOptions" - }, - "preprocessDryRunGetPackageName": { - // If this options is set to true, generateScript will first run with - // "dryRun": true to get package name and related readme.md, - // then for each package, checkout the expected branch and launch generateScript. - "type": "boolean", - "default": false - }, - "parseGenerateOutput": { - // Will this script output to generateOutput.json. - // If not, default behavior will be applied that outcome will be - // detected automatically based on filename regex search. - "type": "boolean", - "default": true - } - }, - "required": [ - "generateScript" - ] - }, - "packageOptions": { - // Get package folder and build / get changelog - "type": "object", - "properties": { - "packageFolderFromFileSearch": { - "oneOf": [ - { - // If this option is set to object, then package folder will be detected automatically. - // based on filename regex search. - // This options must be set to object if parseGenerateOutput is false. - "type": "object", - "properties": { - "searchRegex": { - // Search algorithm: - // For each changed file detected after generation - // PotentialPackageFolder = folder of changed file - // While PotentialPackageFolder is not root folder of sdk repo: - // If PotentialPackageFolder contains a file that matches the searchRegex: - // PackageFolder found, break - // Else: - // PotentialPackageFolder = parent folder of PotentialPackageFolder - "type": "string", - "format": "regex" - }, - "pageNamePrefix": { - // Prefix to be appended to packageName. By default packageName will be the folder name of packageFolder - "type": "string" - } - }, - "required": [ - "searchRegex" - ] - }, - { - // If this option is set to false, then package folder will be from generateOutput.json. - "const": false - } - ], - "default": false, - }, - "buildScript": { - // Build the generated sdk. - // Param: - // Package folder could be a list separated by space if it's from generateOutput.json. - "$ref": "#/definitions/RunOptions" - }, - "changelogScript": { - // Changelog generation and breaking-change detection. - // Param: - // Package folder could be a list separated by space if it's from generateOutput.json. - // Expected output from stdout/stderr: Changelog in markdown - "allOf": { - "$ref": "#/definitions/RunOptions" - }, - "properties": { - "breakingChangeDetect": { - // If stdout or stderr matches this in output of changelog tool - // then we assume this SDK has breaking change. - "$ref": "#/definitions/RunLogFilterOptions" - } - } - } - } - }, - "artifactOptions": { - "artifactPathFromFileSearch": { - "oneOf": [ - { - // If this option is set to object, then artifacts will be detected automatically - // based on filename regex search. - // This options must be set to object if parseGenerateOutput is false. - "type": "object", - "properties": { - "searchRegex": { - // Any file under package folder matching the searchRegex is package artifact. - "type": "string", - "format": "regex", - } - } - }, - { - // If this option is set to false, then package folder will be from generateOutput.json - "const": false - } - ], - "default": false - }, - "installInstructionScript": { - // Generate install instruction that could be shown in spec PR comment (lite version) - // or in generated SDK PR (full version). - // If generateOutput.json contains installInstruction then this could be skipped. - // Param: - // installInstructionInput.json: See #InstallInstructionScriptInput . - // installInstructionOutput.json: See #InstallInstructionScriptInput . - "allOf": { - "$ref": "#/definitions/RunOptions" - } - } - } - }, - "definitions": { - "RunOptions": { - // Options to run a script and collect log. - "type": "object", - "properties": { - "path": { - // Script path related to repo root - "type": "string" - }, - "logPrefix": { - // Prefix to be added to SDK Automation log. By default it would be filename of the script. - "type": "string" - }, - "stdout": { - // How should SDK Automation handle the script stdout stream - "$ref": "#/definitions/RunLogOptions" - }, - "stderr": { - // How should SDK Automation handle the script stderr stream - "$ref": "#/definitions/RunLogOptions" - }, - "exitCode": { - // How should SDK Automation handle non-zero exitCode. - "showInComment": { - // Should we show this error in comment. - "type": "boolean", - "default": true - }, - "result": { - // If script has non-error exitCode how should we mark the script's result. - "type": "string", - "enum": [ - "error", "warning", "ignore" - ], - "default": "error" - } - }, - "required": [ - "path" - ] - } - }, - "RunLogOptions": { - // How should SDK Automation handle the log stream. - "showInComment": { - // Should we show this stream in comment. - "$ref": "#/definitions/RunLogFilterOptions" - }, - "scriptError": { - // If any line match, assume the script fails. - "$ref": "#/definitions/RunLogFilterOptions" - }, - "scriptWarning": { - // If any line match, assume the script warns. - "$ref": "#/definitions/RunLogFilterOptions" - } - }, - "RunLogFilterOptions": { - "oneOf": [ - { - // If line of log match this regex then hit - "type": "string", - "format": "regex" - }, - { - // If set to true, any line of log will hit - "type": "boolean" - } - ], - "default": false - } - } -} -``` + +See [./SwaggerToSdkConfigSchema.json](https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/sdkautomation/SwaggerToSdkConfigSchema.json) ### GenerateInput @@ -524,72 +207,19 @@ Input file for generate script. ], "relatedReadmeMdFiles": [ "specification/cdn/something/readme.md" - ] + ], + "installInstructionInput": { + "isPublic": false, + "downloadUrlPrefix": "https://openapihub.test.azure-devex-tools.com/api/sdk-dl-pub?p=Azure/1234/azure-sdk-for-net/", + "downloadCommandTemplate": "curl -L \"{URL}\" -o {FILENAME}", + "trigger": "pullRequest" + } } ``` #### GenerateInput Schema -```jsonc -{ - "type": "object", - "properties": { - "dryRun": { - // If dryRun is true, generateScript is expected to parse readme.md - // and output the package list with package name and related readme.md. - // Should not run codegen at this time. - "type": "boolean" - }, - "specFolder": { - // Path to local spec folder. - "type": "string" - }, - "headSha": { - // Git head sha. - "type": "string" - }, - "headRef": { - // Git head ref. - // Format will be "refs/pull//merge" or "refs/heads/". - "type": "string" - }, - "repoHttpsUrl": { - // Spec repo url in https without auth. - "type": "string" - }, - "trigger": { - // How this generation is triggered. - "type": "string", - "enum": [ - "pullRequest", - "continuousIntegration" - ] - }, - "changedFiles": { - // Changed file list in spec PR. - "type": "array", - "items": { - "type": "string" - } - }, - "relatedReadmeMdFiles": { - // Related readme.md files that pending generation. - "type": "array", - "items": { - "type": "string" - } - }, - "installInstructionInput": { - // See #InstallInstructionScriptInput - "$ref": "#/definitions/InstallInstructionScriptInput" - } - }, - "required": [ - "specFolder", "headSha", "headRef", "repoHttpsUrl", - "trigger", "changedFiles", "relatedReadmeMdFiles" - ] -} -``` +See [./GenerateInputSchema.json](https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/sdkautomation/GenerateInputSchema.json) ### GenerateOutput @@ -628,79 +258,7 @@ Output file for generate script. #### GenerateOutput Schema -```jsonc -{ - "type": "object", - "properties": { - "packages": { - "type": "array", - "items": { - "$ref": "#/definitions/PackageResult" - } - } - }, - "required": [ - "packages" - ], - "definitions": { - "PackageResult": { - "properties": { - "packageName": { - // Name of package. Will be used in branch name and PR title. - // By default it's folder name of first entry in path. - "type": "string", - }, - "path": { - // List of package content paths. - // If the path points to a folder then - // all the content under the folder will be included. - "type": "array", - "items": { - "type": "string" - } - }, - "readmeMd": { - // List of related readmeMd of this package. - // Must provide this field if dryRun is true. - "type": "array", - "items": { - "type": "string" - } - }, - "changelog": { - "type": "object", - "properties": { - "content": { - // Content of changelog in markdown - "type": "string" - }, - "hasBreakingChange": { - // Does the new package has breaking change - "type": "boolean" - } - }, - "required": [ - "content" - ] - }, - "artifacts": { - "type": "array", - "items": { - "type": "string" - } - }, - "installInstructions": { - // See #InstallInstructionScriptOutput - "$ref": "#/definitions/InstallInstructionScriptOutput" - }, - }, - "required": [ - "path" - ] - } - } -} -``` +See [./GenerateOutputSchema.json](https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/sdkautomation/GenerateOutputSchema.json) ### InstallInstructionScriptInput @@ -724,46 +282,7 @@ Input of install instruction script. #### InstallInstructionScriptInput Schema -```jsonc -{ - "type": "object", - "properties": { - "packageName": { - // The package name. May be skipped if sdk automation don't know the info yet. - "type": "string" - }, - "artifacts": { - // List of artifact's path. May be skipped if sdk automation don't know the info yet. - "type": "array", - "items": { - "type": "string" - } - }, - "isPublic": { - // Is the download url public accessible. - // If it's false, the download command template will be - // az rest --resource -u "{URL}" --output-file {FILENAME} - "type": "boolean", - }, - "downloadUrlPrefix": { - // All the artifacts will be uploaded and user could access the artifact via - // a link composed by this prefix and artifact filename. - "type": "string" - }, - "downloadCommandTemplate": { - // Download command template. Replace {URL} and {FILENAME} to get the real command. - "type": "string" - }, - "trigger": { - "type": "string", - "enum": [ - "pullRequest", - "continuousIntegration" - ] - } - } -} -``` +See [./InstallInstructionScriptInput.json](https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/sdkautomation/InstallInstructionScriptInput.json) ### InstallInstructionScriptOutput @@ -779,23 +298,35 @@ Output of install instruction script. #### InstallInstructionScriptOutput Schema +See [./InstallInstructionScriptOutput.json](https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/sdkautomation/InstallInstructionScriptOutput.json) + +### TriggerType + +#### TriggerType Schema + +```jsonc +{ + // How this generation is triggered. + "$id": "TriggerType", + "type": "string", + "enum": ["pullRequest", "continuousIntegration"] +} +``` + +### InitOutput + +#### InitOutput Schema + ```jsonc { "type": "object", "properties": { - "full": { - // Full version of install instruction will be shown in generated SDK PR. - // Should be in markdown format. - "type": "string" - }, - "lite": { - // Lite version of install instruction will be shown in generated SDK PR. - // Should be in markdown format. - "type": "string" + "envs": { + // Environment variable to be set in following scripts. + "additionalProperties": { + "type": "string" + } } - }, - "required": [ - "full" - ] + } } -``` +``` \ No newline at end of file