Skip to content

Commit

Permalink
Update all readme.azureresourceschema.md (#10647)
Browse files Browse the repository at this point in the history
* run multiapi

* Update script to output schema input files to readme.azureresourceschema.md

* Update readme.azureresourceschema.md structure
  • Loading branch information
leni-msft authored Aug 31, 2020
1 parent 05465c3 commit a615f5c
Show file tree
Hide file tree
Showing 178 changed files with 3,619 additions and 7,915 deletions.
67 changes: 20 additions & 47 deletions scripts/multiapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import * as yaml from "js-yaml"
type Code = {
readonly "input-file"?: ReadonlyArray<string>|string
}
const magic = `yaml $(tag) == 'all-api-versions' /* autogenerated */`;
const header = `## Multi-API/Profile support for AutoRest v3 generators`;

const yamlBegin = `yaml $(tag) == 'all-api-versions' /* autogenerated */`;

const main = async (specificationDir: string, profilesDir: string) => {
try {
Expand All @@ -29,77 +27,52 @@ const main = async (specificationDir: string, profilesDir: string) => {
if (
c.type === "code_block" &&
c.info !== null &&
(c.info.startsWith("yaml") && !c.info.startsWith(magic)) &&
(c.info.startsWith("yaml") && !c.info.startsWith(yamlBegin)) &&
c.literal !== null
) {
const DOC = (yaml.load(c.literal) as Code);
if (DOC ) {
const y = DOC['input-file']
if (typeof y === "string") {
set.add(`$(this-folder)/${y}`)
set.add(y)
} else if (it.isArray(y)) {
for (const i of y) {
set.add(`$(this-folder)/${i}`)
set.add(i)
}
}
}

}
}
if( !content.includes(header) ) {
// add the header to the content
content = content + `
${header}
AutoRest V3 generators require the use of \`--tag=all-api-versions\` to select api files.
This block is updated by an automatic script. Edits may be lost!
\`\`\` ${magic}
\`\`\`
const block =
`## AzureResourceSchema
If there are files that should not be in the \`all-api-versions\` set,
uncomment the \`exclude-file\` section below and add the file paths.
These settings apply only when \`--azureresourceschema\` is specified on the command line.
\`\`\` yaml $(tag) == 'all-api-versions'
#exclude-file:
# - $(this-folder)/Microsoft.Example/stable/2010-01-01/somefile.json
\`\`\`
### AzureResourceSchema multi-api
`
}
// update the autogenrated block with the new content.
/* const readMeMulti = cm.createNode(
"document",
cm.createNode(
"heading",
cm.createText("# Multi-API/Profile support for AutoRest v3 generators")
),
cm.createCodeBlock(
magic,
yaml.dump({ "input-file": it.toArray(set), "require": `$(this-folder)/${path.relative(f.dir, profilesDir).replace(/\\/g, '/')}/readme.md` }, { lineWidth: 1000 })
)
)
const block1 =cm.markDownExToString({ markDown: cm.createCodeBlock(
magic,
yaml.dump({
"input-file": it.toArray(set),
"require": `$(this-folder)/${path.relative(f.dir, profilesDir).replace(/\\/g, '/')}/readme.md` }, { lineWidth: 1000 })
)});*/
const block =
`\`\`\` ${magic}
\`\`\` yaml $(azureresourceschema) && $(multiapi)
# include the azure profile definitions from the standard location
require: $(this-folder)/${path.relative(f.dir, profilesDir).replace(/\\/g, '/')}/readme.md
require: ${path.relative(f.dir, profilesDir).replace(/\\/g, '/')}/readme.md
output-folder: $(azureresourceschema-folder)/schemas
# all the input files across all versions
${yaml.dump({ 'input-file': it.toArray(set) },{ lineWidth: 1000 } )}
\`\`\``
content = content.replace( /``` yaml \$\(tag\) == 'all-api-versions' \/\* autogenerated \*\/[\S\s]*?```/g, block)
content = content.replace( /``` yaml \$\(tag\) == 'all-api-versions' \/\* autogenerated \*\/[\S\s]*?```/g, '')
content = content.replace( /``` yaml \$\(tag\) == 'all-api-versions'[\S\s]*?```/g, '')
content = content.replace( /## Multi-API\/Profile support for AutoRest v3 generators[\S\s]*/g, '')

if(original_content !== content ){
console.log(`Updating: ${file}`);
fs.writeFile(path.join(f.dir, "readme.md"), content)
}

if (f.dir.endsWith('/resource-manager')) {
console.log(`Rewriting: ${f.dir}/readme.azureresourceschema.md`);
fs.writeFile(path.join(f.dir, "readme.azureresourceschema.md"), block);
}

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ These settings apply only when `--azureresourceschema` is specified on the comma
### AzureResourceSchema multi-api

``` yaml $(azureresourceschema) && $(multiapi)
batch:
- tag: package-2018-12-03
```
# include the azure profile definitions from the standard location
require: ../../../profiles/readme.md

### Tag: package-2018-12-03 and azureresourceschema
These settings apply only when `--tag=package-2018-12-03 --azureresourceschema` is specified on the command line.
Please also specify `--azureresourceschema-folder=<path to the root directory of your azure-resource-manager-schemas clone>`.

``` yaml $(tag) == 'package-2018-12-03' && $(azureresourceschema)
output-folder: $(azureresourceschema-folder)/schemas
```

# all the input files across all versions
input-file:
- Microsoft.EnterpriseKnowledgeGraph/preview/2018-12-03/EnterpriseKnowledgeGraphSwagger.json

```
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,14 @@ These settings apply only when `--azureresourceschema` is specified on the comma
### AzureResourceSchema multi-api

``` yaml $(azureresourceschema) && $(multiapi)
batch:
- tag: package-2018-03
- tag: package-2017-05
```
# include the azure profile definitions from the standard location
require: ../../../profiles/readme.md

### Tag: package-2018-03 and azureresourceschema
These settings apply only when `--tag=package-2018-03 --azureresourceschema` is specified on the command line.
Please also specify `--azureresourceschema-folder=<path to the root directory of your azure-resource-manager-schemas clone>`.

``` yaml $(tag) == 'package-2018-03' && $(azureresourceschema)
output-folder: $(azureresourceschema-folder)/schemas
```

### Tag: package-2017-05 and azureresourceschema

These settings apply only when `--tag=package-2017-05 --azureresourceschema` is specified on the command line.
Please also specify `--azureresourceschema-folder=<path to the root directory of your azure-resource-manager-schemas clone>`.

``` yaml $(tag) == 'package-2017-05' && $(azureresourceschema)
output-folder: $(azureresourceschema-folder)/schemas
```
# all the input files across all versions
input-file:
- Microsoft.Addons/preview/2018-03-01/addons-swagger.json
- Microsoft.Addons/preview/2017-05-15/Addons.json

```
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ These settings apply only when `--azureresourceschema` is specified on the comma
### AzureResourceSchema multi-api

``` yaml $(azureresourceschema) && $(multiapi)
batch:
- tag: package-2014-01
```
# include the azure profile definitions from the standard location
require: ../../../profiles/readme.md

### Tag: package-2014-01 and azureresourceschema
These settings apply only when `--tag=package-2014-01 --azureresourceschema` is specified on the command line.
Please also specify `--azureresourceschema-folder=<path to the root directory of your azure-resource-manager-schemas clone>`.

``` yaml $(tag) == 'package-2014-01' && $(azureresourceschema)
output-folder: $(azureresourceschema-folder)/schemas
```

# all the input files across all versions
input-file:
- Microsoft.ADHybridHealthService\stable\2014-01-01\ADHybridHealthService.json

```
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,17 @@ These settings apply only when `--azureresourceschema` is specified on the comma
### AzureResourceSchema multi-api

``` yaml $(azureresourceschema) && $(multiapi)
batch:
- tag: package-2020-07-preview
- tag: package-2020-01
- tag: package-2017-04
- tag: package-2017-03
- tag: package-2016-07-preview
```
# include the azure profile definitions from the standard location
require: ../../../profiles/readme.md

### Tag: package-2020-07-preview and azureresourceschema
These settings apply only when `--tag=package-2020-07-preview --azureresourceschema` is specified on the command line.
Please also specify `--azureresourceschema-folder=<path to the root directory of your azure-resource-manager-schemas clone>`.

``` yaml $(tag) == 'package-2020-07-preview' && $(azureresourceschema)
output-folder: $(azureresourceschema-folder)/schemas
```

### Tag: package-2020-01 and azureresourceschema

These settings apply only when `--tag=package-2020-01 --azureresourceschema` is specified on the command line.
Please also specify `--azureresourceschema-folder=<path to the root directory of your azure-resource-manager-schemas clone>`.

``` yaml $(tag) == 'package-2020-01' && $(azureresourceschema)
output-folder: $(azureresourceschema-folder)/schemas
```

### Tag: package-2017-04 and azureresourceschema

These settings apply only when `--tag=package-2017-04 --azureresourceschema` is specified on the command line.
Please also specify `--azureresourceschema-folder=<path to the root directory of your azure-resource-manager-schemas clone>`.

``` yaml $(tag) == 'package-2017-04' && $(azureresourceschema)
output-folder: $(azureresourceschema-folder)/schemas
```

### Tag: package-2017-03 and azureresourceschema

These settings apply only when `--tag=package-2017-03 --azureresourceschema` is specified on the command line.
Please also specify `--azureresourceschema-folder=<path to the root directory of your azure-resource-manager-schemas clone>`.

``` yaml $(tag) == 'package-2017-03' && $(azureresourceschema)
output-folder: $(azureresourceschema-folder)/schemas
```

### Tag: package-2016-07-preview and azureresourceschema

These settings apply only when `--tag=package-2016-07-preview --azureresourceschema` is specified on the command line.
Please also specify `--azureresourceschema-folder=<path to the root directory of your azure-resource-manager-schemas clone>`.

``` yaml $(tag) == 'package-2016-07-preview' && $(azureresourceschema)
output-folder: $(azureresourceschema-folder)/schemas
```
# all the input files across all versions
input-file:
- Microsoft.Advisor/preview/2020-07-01-preview/advisor.json
- Microsoft.Advisor/stable/2020-01-01/advisor.json
- Microsoft.Advisor/stable/2017-04-19/advisor.json
- Microsoft.Advisor/stable/2017-03-31/advisor.json
- Microsoft.Advisor/preview/2016-07-12-preview/advisor.json

```
Original file line number Diff line number Diff line change
Expand Up @@ -5,66 +5,20 @@ These settings apply only when `--azureresourceschema` is specified on the comma
### AzureResourceSchema multi-api

``` yaml $(azureresourceschema) && $(multiapi)
batch:
- tag: package-2019-06-preview
- tag: package-2019-06
- tag: package-2019-03
- tag: package-preview-2019-05
- tag: package-2018-05
- tag: package-2018-05-preview
```
# include the azure profile definitions from the standard location
require: ../../../profiles/readme.md

### Tag: package-2019-06-preview and azureresourceschema
These settings apply only when `--tag=package-2019-06-preview --azureresourceschema` is specified on the command line.
Please also specify `--azureresourceschema-folder=<path to the root directory of your azure-resource-manager-schemas clone>`.

``` yaml $(tag) == 'package-2019-06-preview' && $(azureresourceschema)
output-folder: $(azureresourceschema-folder)/schemas
```

### Tag: package-2019-06 and azureresourceschema

These settings apply only when `--tag=package-2019-06 --azureresourceschema` is specified on the command line.
Please also specify `--azureresourceschema-folder=<path to the root directory of your azure-resource-manager-schemas clone>`.

``` yaml $(tag) == 'package-2019-06' && $(azureresourceschema)
output-folder: $(azureresourceschema-folder)/schemas
```

### Tag: package-2019-03 and azureresourceschema

These settings apply only when `--tag=package-2019-03 --azureresourceschema` is specified on the command line.
Please also specify `--azureresourceschema-folder=<path to the root directory of your azure-resource-manager-schemas clone>`.

``` yaml $(tag) == 'package-2019-03' && $(azureresourceschema)
output-folder: $(azureresourceschema-folder)/schemas
```

### Tag: package-preview-2019-05 and azureresourceschema

These settings apply only when `--tag=package-preview-2019-05 --azureresourceschema` is specified on the command line.
Please also specify `--azureresourceschema-folder=<path to the root directory of your azure-resource-manager-schemas clone>`.

``` yaml $(tag) == 'package-preview-2019-05' && $(azureresourceschema)
output-folder: $(azureresourceschema-folder)/schemas
```

### Tag: package-2018-05 and azureresourceschema

These settings apply only when `--tag=package-2018-05 --azureresourceschema` is specified on the command line.
Please also specify `--azureresourceschema-folder=<path to the root directory of your azure-resource-manager-schemas clone>`.

``` yaml $(tag) == 'package-2018-05' && $(azureresourceschema)
output-folder: $(azureresourceschema-folder)/schemas
```

### Tag: package-2018-05-preview and azureresourceschema

These settings apply only when `--tag=package-2018-05-preview --azureresourceschema` is specified on the command line.
Please also specify `--azureresourceschema-folder=<path to the root directory of your azure-resource-manager-schemas clone>`.

``` yaml $(tag) == 'package-2018-05-preview' && $(azureresourceschema)
output-folder: $(azureresourceschema-folder)/schemas
```

# all the input files across all versions
input-file:
- Microsoft.AlertsManagement/preview/2019-05-05-preview/ActionRules.json
- Microsoft.AlertsManagement/preview/2019-05-05-preview/AlertsManagement.json
- Microsoft.AlertsManagement/preview/2019-05-05-preview/SmartGroups.json
- Microsoft.AlertsManagement/stable/2019-06-01/SmartDetectorAlertRulesApi.json
- Microsoft.AlertsManagement/stable/2019-03-01/AlertsManagement.json
- Microsoft.AlertsManagement/stable/2019-03-01/SmartDetectorAlertRulesApi.json
- Microsoft.AlertsManagement/stable/2018-05-05/AlertsManagement.json
- Microsoft.AlertsManagement/preview/2018-05-05-preview/AlertsManagement.json

```
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,16 @@ These settings apply only when `--azureresourceschema` is specified on the comma
### AzureResourceSchema multi-api

``` yaml $(azureresourceschema) && $(multiapi)
batch:
- tag: package-2017-08
- tag: package-2017-07
- tag: package-2016-05
```
# include the azure profile definitions from the standard location
require: ../../../profiles/readme.md

### Tag: package-2017-08 and azureresourceschema
These settings apply only when `--tag=package-2017-08 --azureresourceschema` is specified on the command line.
Please also specify `--azureresourceschema-folder=<path to the root directory of your azure-resource-manager-schemas clone>`.

``` yaml $(tag) == 'package-2017-08' && $(azureresourceschema)
output-folder: $(azureresourceschema-folder)/schemas
```

### Tag: package-2017-07 and azureresourceschema

These settings apply only when `--tag=package-2017-07 --azureresourceschema` is specified on the command line.
Please also specify `--azureresourceschema-folder=<path to the root directory of your azure-resource-manager-schemas clone>`.

``` yaml $(tag) == 'package-2017-07' && $(azureresourceschema)
output-folder: $(azureresourceschema-folder)/schemas
```

### Tag: package-2016-05 and azureresourceschema

These settings apply only when `--tag=package-2016-05 --azureresourceschema` is specified on the command line.
Please also specify `--azureresourceschema-folder=<path to the root directory of your azure-resource-manager-schemas clone>`.

``` yaml $(tag) == 'package-2016-05' && $(azureresourceschema)
output-folder: $(azureresourceschema-folder)/schemas
```
# all the input files across all versions
input-file:
- Microsoft.AnalysisServices/stable/2017-08-01/analysisservices.json
- Microsoft.AnalysisServices/preview/2017-08-01-beta/analysisservices.json
- Microsoft.AnalysisServices/stable/2017-07-14/analysisservices.json
- Microsoft.AnalysisServices/stable/2016-05-16/analysisservices.json

```
Loading

0 comments on commit a615f5c

Please sign in to comment.