azure-rest-api-specs-1/documentation/sdkautomation/SwaggerToSdkConfigSchema.json

300 строки
10 KiB
JSON
Исходник Обычный вид История

{
"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: <path_to_initInput.json> <path_to_initOutput.json>
// 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: <path_to_generateInput.json> <path_to_generateOutput.json>
// 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: <path_to_package_folder>
// 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: <path_to_package_folder>
// 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: <path_to_installInstructionInput.json> <path_to_installInstructionOutput.json>
// 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
}
}
}