Skip to content

Commit

Permalink
Merge branch 'master' into merge-network-release
Browse files Browse the repository at this point in the history
# Conflicts:
#	specification/network/resource-manager/readme.go.md
#	specification/network/resource-manager/readme.python.md
  • Loading branch information
anton-evseev committed Feb 12, 2019
2 parents b616d58 + db312de commit cf5b233
Show file tree
Hide file tree
Showing 798 changed files with 52,835 additions and 5,127 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,5 @@ AutoRest.*
output/*
errors.txt
warnings.txt

/dist/
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ env:
- MODE=semantic PR_ONLY=true CHECK_NAME="Semantic Validator"
- MODE=semantic PR_ONLY=false
- MODE=model PR_ONLY=true CHECK_NAME="Model Validator"
# - MODE=model PR_ONLY=false
- MODE=BreakingChange PR_ONLY=true CHECK_NAME="Breaking Changes"
- MODE=lintdiff PR_ONLY=true CHECK_NAME="Linter Diff"
matrix:
Expand All @@ -27,6 +28,7 @@ matrix:
- env: MODE=java CHECK_NAME="SDK Generation - Java"
- env: MODE=go CHECK_NAME="SDK Generation - Go"
- env: MODE=semantic PR_ONLY=false
- env: MODE=model PR_ONLY=false
- env: MODE=model PR_ONLY=true CHECK_NAME="Model Validator"
- env: MODE=BreakingChange PR_ONLY=true CHECK_NAME="Breaking Changes"
install: true
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/specification/consumption/ @kjeur @panda-wang
/specification/containerinstance/ @samkreter
/specification/containerregistry/ @djyou
/specification/containerservices/ @mboersma
/specification/containerservice/ @mboersma
/specification/cosmos-db/ @dmakwana
/specification/customer-insights/ @tjlvtao
/specification/datafactory/ @zhangyd2015
Expand Down
6 changes: 3 additions & 3 deletions arm-compute/quickstart-templates/aliases.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"Debian":{
"publisher":"credativ",
"offer":"Debian",
"sku":"8",
"sku":"9",
"version":"latest"
},
"openSUSE-Leap": {
Expand All @@ -44,13 +44,13 @@
"SLES":{
"publisher":"SUSE",
"offer":"SLES",
"sku":"12-SP2",
"sku":"15",
"version":"latest"
},
"UbuntuLTS":{
"publisher":"Canonical",
"offer":"UbuntuServer",
"sku":"16.04-LTS",
"sku":"18.04-LTS",
"version":"latest"
}
},
Expand Down
4 changes: 2 additions & 2 deletions documentation/openapi-authoring-automated-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ We request OpenAPI(Swagger) spec authoring be assigned to engineers who have an

| Id | Rule Name | Applies to |
| --- | --- | --- |
| [R4000](#r4000-2) | [ParameterDescriptionRequired](#r4000-2) | ARM and Data plane OpenAPI(swagger) specs |
| [R4000](#r4000) | [ParameterDescriptionRequired](#r4000) | ARM and Data plane OpenAPI(swagger) specs |
| [R4000](#r4000-3) | [DescriptiveDescriptionRequired](#r4000-3) | ARM and Data plane OpenAPI(swagger) specs |
| [R4000](#r4000-4) | [DescriptionAndTitleMissing](#r4000-4) | ARM and Data plane OpenAPI(swagger) specs |
| [R4000](#r4000-5) | [OperationDescriptionOrSummaryRequired](#r4000-5) | ARM and Data plane OpenAPI(swagger) specs |
Expand Down Expand Up @@ -1662,7 +1662,7 @@ Links: [Index](#index) | [Error vs. Warning](#error-vs-warning) | [Automated Rul

Links: [Index](#index) | [Error vs. Warning](#error-vs-warning) | [Automated Rules](#automated-rules) | [ARM](#arm-violations): [Errors](#arm-errors) or [Warnings](#arm-warnings) | [SDK](#sdk-violations): [Errors](#sdk-errors) or [Warnings](#sdk-warnings)

### <a name="r4000-2" />R4000 ParameterDescriptionRequired
### <a name="r4000" />R4000 ParameterDescriptionRequired
**Category** : SDK Warning

**Applies to** : ARM and Data plane OpenAPI(swagger) specs
Expand Down
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,21 @@
"@microsoft.azure/async-io": "^1.0.21",
"@microsoft.azure/literate": "^1.0.21",
"@microsoft.azure/polyfill": "^1.0.17",
"@ts-common/local-install": "^0.0.8",
"@ts-common/commonmark-to-markdown": "^1.1.9",
"@ts-common/fs": "0.1.0",
"@types/js-yaml": "^3.12.0",
"fs-extra": "^3.0.1",
"glob": "^5.0.14",
"js-yaml": "^3.8.2",
"json-schema-ref-parser": "^3.1.2",
"mocha": "*",
"oad": "^0.1.11",
"oav": "^0.9.6",
"oav": "^0.13.4",
"request": "^2.61.0",
"request-promise-native": "^1.0.5",
"z-schema": "^3.24.2"
"typescript": "^3.2.4",
"z-schema": "^3.25.0",
"ts-node": "^8.0.1"
},
"dependencies": {
"@octokit/rest": "^15.2.6"
Expand All @@ -39,6 +43,7 @@
"scripts": {
"test": "mocha -t 500000 --reporter min",
"oav": "oav",
"li": "local-install"
"tsc": "tsc",
"multiapi": "ts-node ./scripts/multiapi.ts"
}
}
36 changes: 28 additions & 8 deletions scripts/modelValidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,38 @@
'use strict';

const utils = require('../test/util/utils')
const oav = require('oav');
const cp = require("child_process")

const exec = (cmd, options) => {
const result = cp.spawnSync(
cmd,
{
...options,
shell: true,
stdio: [process.stdin, process.stdout, process.stderr]
}
)
return result.status
}

async function main() {
const swaggersToProcess = utils.getFilesChangedInPR();
// Useful when debugging a test for a particular swagger.
// Just update the regex. That will return an array of filtered items.
// swaggersToProcess = swaggersToProcess.filter(function(item) {
// return (item.match(/.*Microsoft.Logic.*2016-06-01.*/ig) !== null);
// });
let result = 0
for (const swagger of swaggersToProcess) {
await oav.validateExamples(swagger, null, {consoleLogLevel: 'error', pretty: true});
try {
// await oav.validateExamples(swagger, null, {consoleLogLevel: 'error', pretty: true});
// run OAV as a separate process to avoid memory issues.
const r = exec(`node node_modules/oav/dist/cli.js validate-example ${swagger} --pretty`)
if (result === 0) {
result = r
}
} catch (e) {
console.error("error: ")
console.error(e)
result = 1
}
}
return result
}

main()
main()
1 change: 1 addition & 0 deletions scripts/momentOfTruth.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ async function getLinterResult(swaggerPath) {

let resultString = stdout + stderr;
if (resultString.indexOf('{') !== -1) {
resultString = resultString.replace(/Processing batch task - {.*} \.\n/g, "");
resultString = "[" + resultString.substring(resultString.indexOf('{')).trim().replace(/\}\n\{/g, "},\n{") + "]";
//console.log('>>>>>> Trimmed Result...');
//console.log(resultString);
Expand Down
66 changes: 66 additions & 0 deletions scripts/multiapi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import * as fs from "@ts-common/fs"
import * as process from "process"
import * as path from "path"
import * as cm from "@ts-common/commonmark-to-markdown"
import * as it from "@ts-common/iterator"
import * as yaml from "js-yaml"

type Code = {
readonly "input-file"?: ReadonlyArray<string>|string
}

const main = async (dir: string) => {
try {
const list = fs.recursiveReaddir(dir)
for await (const file of list) {
const f = path.parse(file)
if (f.base === "readme.md") {
console.log(`processing ${file}`)
const content = (await fs.readFile(file)).toString()
const readMe = cm.parse(content)
const set = new Set<string>()
for (const c of cm.iterate(readMe.markDown)) {
if (
c.type === "code_block" &&
c.info !== null &&
c.info.startsWith("yaml") &&
c.literal !== null
) {
const y = (yaml.load(c.literal) as Code)["input-file"]
if (typeof y === "string") {
set.add(y)
} else if (it.isArray(y)) {
for (const i of y) {
set.add(i)
}
}
}
}
const readMeMulti = cm.createNode(
"document",
cm.createNode(
"heading",
cm.createText("Multi-API support for AutoRest v3 generators")
),
cm.createNode(
"block_quote",
cm.createNode(
"paragraph",
cm.createText("see https://aka.ms/autorest")
)
),
cm.createCodeBlock(
"yaml $(enable-multi-api)",
yaml.dump({ "input-file": it.toArray(set) }, { lineWidth: 1000 })
)
)
const x = cm.markDownExToString({ markDown: readMeMulti })
fs.writeFile(path.join(f.dir, "readme.enable-multi-api.md"), x)
}
}
} catch (e) {
console.error(e)
}
}

main(path.join(process.cwd(), "specification"))
Loading

0 comments on commit cf5b233

Please sign in to comment.