Skip to content

Commit

Permalink
PMM-4052 Fix order of fields in Swagger. (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
BupycHuk authored and AlekSi committed Oct 9, 2019
1 parent b450e94 commit 2b723d3
Show file tree
Hide file tree
Showing 68 changed files with 9,536 additions and 6,986 deletions.
57 changes: 51 additions & 6 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ required = [
"github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger",
"github.com/go-swagger/go-swagger/cmd/swagger",
"github.com/BurntSushi/go-sumtype",
"github.com/Percona-Lab/swagger-order",

# require key dependencies explicitly to make dep work
"github.com/golang/protobuf/proto",
Expand Down Expand Up @@ -44,7 +45,8 @@ required = [
version = "=1.11.1"
[[constraint]]
name = "github.com/go-swagger/go-swagger"
version = "=0.20.1"
source = "github.com/Percona-Lab/go-swagger"
version = "=0.20.1-percona2" # TODO switch to upstream as soon as https://github.com/go-swagger/go-swagger/pull/2074 is released.
[[constraint]]
name = "github.com/sirupsen/logrus"
version = "=1.4.2"
Expand Down
5 changes: 4 additions & 1 deletion api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ gen: clean ## Generate files.
../vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \
../vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger \
../vendor/github.com/go-swagger/go-swagger/cmd/swagger \
../vendor/github.com/Percona-Lab/swagger-order \
../vendor/github.com/BurntSushi/go-sumtype

# generated by ./prototool break descriptor-set . -o v2.0.0.descriptor
Expand All @@ -28,7 +29,7 @@ gen: clean ## Generate files.

for API in agentlocalpb serverpb inventorypb managementpb qanpb ; do \
set -x ; \
swagger mixin $$API/json/header.json $$API/*.swagger.json --output=$$API/json/$$API.json ; \
swagger mixin $$API/json/header.json $$API/*.swagger.json --output=$$API/json/$$API.json --keep-spec-order; \
swagger flatten --with-flatten=expand --with-flatten=remove-unused $$API/json/$$API.json --output=$$API/json/$$API.json ; \
swagger validate $$API/json/$$API.json ; \
swagger generate client --with-flatten=expand --with-flatten=remove-unused --spec=$$API/json/$$API.json --target=$$API/json \
Expand All @@ -50,6 +51,8 @@ gen: clean ## Generate files.
qanpb/json/qanpb.json
swagger validate swagger/swagger.json

swagger-order --output=swagger/swagger.json swagger/swagger.json

make clean_swagger
go fmt ../...
go-sumtype ../...
Expand Down
36 changes: 24 additions & 12 deletions api/agentlocalpb/json/agentlocalpb.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
"get_network_info": {
"description": "Returns network info (latency and clock_drift) if true.",
"type": "boolean",
"format": "boolean"
"format": "boolean",
"x-order": 0
}
}
}
Expand All @@ -94,7 +95,8 @@
"type": "object",
"properties": {
"agent_id": {
"type": "string"
"type": "string",
"x-order": 0
},
"agents_info": {
"type": "array",
Expand All @@ -103,7 +105,8 @@
"type": "object",
"properties": {
"agent_id": {
"type": "string"
"type": "string",
"x-order": 0
},
"agent_type": {
"description": "AgentType describes supported Agent types.",
Expand Down Expand Up @@ -137,44 +140,53 @@
]
}
}
}
},
"x-order": 3
},
"config_filepath": {
"description": "Config file path if pmm-agent was started with one.",
"type": "string"
"type": "string",
"x-order": 4
},
"runs_on_node_id": {
"type": "string"
"type": "string",
"x-order": 1
},
"server_info": {
"description": "ServerInfo contains information about the PMM Server.",
"type": "object",
"properties": {
"clock_drift": {
"description": "Clock drift from PMM Server (if agent is connected).",
"type": "string"
"type": "string",
"x-order": 5
},
"connected": {
"description": "True if pmm-agent is currently connected to the server.",
"type": "boolean",
"format": "boolean"
"format": "boolean",
"x-order": 2
},
"insecure_tls": {
"description": "PMM Server's TLS certificate validation should be skipped if true.",
"type": "boolean",
"format": "boolean"
"format": "boolean",
"x-order": 1
},
"latency": {
"description": "Ping time from pmm-agent to pmm-managed (if agent is connected).",
"type": "string"
"type": "string",
"x-order": 4
},
"url": {
"description": "PMM Server URL in a form https://HOST:PORT/.",
"type": "string"
"type": "string",
"x-order": 0
},
"version": {
"description": "PMM Server version (if agent is connected).",
"type": "string"
"type": "string",
"x-order": 3
}
}
}
Expand Down
24 changes: 12 additions & 12 deletions api/agentlocalpb/json/client/agent_local/status_responses.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2b723d3

Please sign in to comment.