Bumping k8s dependencies to 1.13

This commit is contained in:
Cheng Xing
2018-11-16 14:08:25 -08:00
parent 305407125c
commit b4c0b68ec7
8002 changed files with 884099 additions and 276228 deletions

View File

@@ -0,0 +1,20 @@
GNOSTIC = $(GOPATH)/src/github.com/googleapis/gnostic
plugin:
node_modules/.bin/pbjs -t json \
$(GNOSTIC)/OpenAPIv2/OpenAPIv2.proto \
$(GNOSTIC)/OpenAPIv3/OpenAPIv3.proto \
$(GNOSTIC)/discovery/discovery.proto \
$(GNOSTIC)/surface/surface.proto \
$(GNOSTIC)/plugins/plugin.proto \
> bundle.json
node_modules/.bin/nexe gnostic-lint-operations.js
run: plugin
gnostic $(GNOSTIC)/examples/v2.0/yaml/petstore.yaml --lint-operations
setup:
npm install protobufjs
npm install get-stdin
npm install nexe

View File

@@ -0,0 +1,15 @@
This directory contains a gnostic linter written with node.
It is built using [dcodeIO/Protobuf.js](https://github.com/dcodeIO/ProtoBuf.js).
### SETUP
- Install node.
- Run `make setup` to install node dependencies.
### TRY IT
- Run `make run` to test-run the plugin.

View File

@@ -0,0 +1,47 @@
// import libraries
const protobuf = require("protobufjs")
const getStdin = require('get-stdin')
// import messages
const root = protobuf.Root.fromJSON(require("./bundle.json"))
const Request = root.lookupType("gnostic.plugin.v1.Request")
const Response = root.lookupType("gnostic.plugin.v1.Response")
const Document = root.lookupType("openapi.v2.Document")
getStdin.buffer().then(buffer => {
const request = Request.decode(buffer)
messages = []
for (var j in request.models) {
const m = request.models[j]
if (m.type_url == "openapi.v2.Document") {
const openapi2 = Document.decode(m.value)
const paths = openapi2.paths.path
for (var i in paths) {
const path = paths[i]
//console.error('path %s\n\n', path.name)
const getOperation = path.value.get
if (getOperation && getOperation.operationId == "") {
messages.push({level:3, code:"NOOPERATIONID", text:"No operation id.", keys:["paths", path.name, "get"]})
}
const postOperation = path.value.post
if (postOperation && postOperation.operationId == "") {
messages.push({level:3, code:"NOOPERATIONID", text:"No operation id.", keys:["paths", path.name, "post"]})
}
//console.error('get %s\n\n', JSON.stringify(getOperation))
}
}
}
const payload = {
messages: messages
}
// Verify the payload if necessary (i.e. when possibly incomplete or invalid)
const errMsg = Response.verify(payload)
if (errMsg)
throw Error(errMsg)
const message = Response.create(payload)
process.stdout.write(Response.encode(message).finish())
}).catch(err => console.error(err))