mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
API: Fix failure to generate swagger specification due to missing binary (#51551)
* Fix swagger generation Add installing binary as dependency to the target * Some more fixes
This commit is contained in:
parent
3bd2bdcebb
commit
a5924315f8
4
Makefile
4
Makefile
@ -42,7 +42,7 @@ $(NGALERT_SPEC_TARGET):
|
||||
$(MERGED_SPEC_TARGET): $(SPEC_TARGET) $(NGALERT_SPEC_TARGET) ## Merge generated and ngalert API specs
|
||||
go run pkg/api/docs/merge/merge_specs.go -o=$(MERGED_SPEC_TARGET) $(<) $(NGALERT_SPEC_TARGET)
|
||||
|
||||
--swagger-api-spec: $(API_DEFINITION_FILES) ## Generate API Swagger specification
|
||||
--swagger-api-spec: $(API_DEFINITION_FILES) $(SWAGGER) ## Generate API Swagger specification
|
||||
SWAGGER_GENERATE_EXTENSION=false $(SWAGGER) generate spec -m -w pkg/server -o public/api-spec.json \
|
||||
-x "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions" \
|
||||
-x "github.com/prometheus/alertmanager" \
|
||||
@ -50,7 +50,7 @@ $(MERGED_SPEC_TARGET): $(SPEC_TARGET) $(NGALERT_SPEC_TARGET) ## Merge generated
|
||||
|
||||
swagger-api-spec: gen-go --swagger-api-spec $(MERGED_SPEC_TARGET) validate-api-spec
|
||||
|
||||
validate-api-spec: $(MERGED_SPEC_TARGET) ## Validate API spec
|
||||
validate-api-spec: $(MERGED_SPEC_TARGET) $(SWAGGER) ## Validate API spec
|
||||
$(SWAGGER) validate $(<)
|
||||
|
||||
clean-api-spec:
|
||||
|
@ -4,7 +4,6 @@ include ../../../../../.bingo/Variables.mk
|
||||
|
||||
API_DIR = definitions
|
||||
GO_PKG_FILES = $(shell find $(API_DIR) -name *.go -print)
|
||||
SWAGGER_TAG ?= latest
|
||||
|
||||
PATH_DOWN = pkg/services/ngalert/api/tooling
|
||||
PATH_UP = ../../../../..
|
||||
@ -22,8 +21,8 @@ ifneq ($(OS),Windows_NT)
|
||||
endif
|
||||
endif
|
||||
|
||||
spec.json spec-stable.json: $(GO_PKG_FILES)
|
||||
SWAGGER_GENERATE_EXTENSION=false $(SWAGGER) generate spec -m -w $(API_DIR) -o spec.json && $(SWAGGER) generate spec -m --include-tag=stable -o spec-stable.json
|
||||
spec.json spec-stable.json: $(GO_PKG_FILES) $(SWAGGER)
|
||||
SWAGGER_GENERATE_EXTENSION=false $(SWAGGER) generate spec -m -w $(API_DIR) -o spec.json && SWAGGER_GENERATE_EXTENSION=false $(SWAGGER) generate spec -m --include-tag=stable -o spec-stable.json
|
||||
|
||||
post.json: spec.json
|
||||
go run cmd/clean-swagger/main.go -if $(<) -of $@
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -470,101 +470,6 @@
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"CreateDashboardSnapshotCommand": {
|
||||
"properties": {
|
||||
"Result": {
|
||||
"$ref": "#/definitions/DashboardSnapshot"
|
||||
},
|
||||
"dashboard": {
|
||||
"$ref": "#/definitions/Json"
|
||||
},
|
||||
"deleteKey": {
|
||||
"description": "Unique key used to delete the snapshot. It is different from the `key` so that only the creator can delete the snapshot. Required if `external` is `true`.",
|
||||
"type": "string"
|
||||
},
|
||||
"expires": {
|
||||
"default": 0,
|
||||
"description": "When the snapshot should expire in seconds in seconds. Default is never to expire.",
|
||||
"format": "int64",
|
||||
"type": "integer"
|
||||
},
|
||||
"external": {
|
||||
"default": false,
|
||||
"description": "these are passed when storing an external snapshot ref\nSave the snapshot on an external server rather than locally.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"key": {
|
||||
"description": "Define the unique key. Required if `external` is `true`.",
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"description": "Snapshot name",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"dashboard"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"DashboardSnapshot": {
|
||||
"description": "DashboardSnapshot model",
|
||||
"properties": {
|
||||
"Created": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
},
|
||||
"Dashboard": {
|
||||
"$ref": "#/definitions/Json"
|
||||
},
|
||||
"DashboardEncrypted": {
|
||||
"items": {
|
||||
"format": "uint8",
|
||||
"type": "integer"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"DeleteKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"Expires": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
},
|
||||
"External": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"ExternalDeleteUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"ExternalUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"Id": {
|
||||
"format": "int64",
|
||||
"type": "integer"
|
||||
},
|
||||
"Key": {
|
||||
"type": "string"
|
||||
},
|
||||
"Name": {
|
||||
"type": "string"
|
||||
},
|
||||
"OrgId": {
|
||||
"format": "int64",
|
||||
"type": "integer"
|
||||
},
|
||||
"Updated": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
},
|
||||
"UserId": {
|
||||
"format": "int64",
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"DateTime": {
|
||||
"description": "DateTime is a time but it serializes to ISO8601 format with millis\nIt knows how to read 3 different variations of a RFC3339 date time.\nMost APIs we encounter want either millisecond or second precision times.\nThis just tries to make it worry-free.",
|
||||
"format": "date-time",
|
||||
@ -2687,7 +2592,6 @@
|
||||
"type": "object"
|
||||
},
|
||||
"URL": {
|
||||
"description": "The general form represented is:\n\n[scheme:][//[userinfo@]host][/]path[?query][#fragment]\n\nURLs that do not start with a slash after the scheme are interpreted as:\n\nscheme:opaque[?query][#fragment]\n\nNote that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.\nA consequence is that it is impossible to tell which slashes in the Path were\nslashes in the raw URL and which were %2f. This distinction is rarely important,\nbut when it is, the code should use RawPath, an optional field which only gets\nset if the default encoding is different from Path.\n\nURL's String method uses the EscapedPath method to obtain the path. See the\nEscapedPath method for more details.",
|
||||
"properties": {
|
||||
"ForceQuery": {
|
||||
"type": "boolean"
|
||||
@ -2720,7 +2624,7 @@
|
||||
"$ref": "#/definitions/Userinfo"
|
||||
}
|
||||
},
|
||||
"title": "A URL represents a parsed URL (technically, a URI reference).",
|
||||
"title": "URL is a custom URL type that allows validation at configuration load time.",
|
||||
"type": "object"
|
||||
},
|
||||
"Userinfo": {
|
||||
@ -2890,7 +2794,6 @@
|
||||
"type": "object"
|
||||
},
|
||||
"alertGroup": {
|
||||
"description": "AlertGroup alert group",
|
||||
"properties": {
|
||||
"alerts": {
|
||||
"description": "alerts",
|
||||
@ -2914,6 +2817,7 @@
|
||||
"type": "object"
|
||||
},
|
||||
"alertGroups": {
|
||||
"description": "AlertGroups alert groups",
|
||||
"items": {
|
||||
"$ref": "#/definitions/alertGroup"
|
||||
},
|
||||
@ -3021,6 +2925,7 @@
|
||||
"$ref": "#/definitions/Duration"
|
||||
},
|
||||
"gettableAlert": {
|
||||
"description": "GettableAlert gettable alert",
|
||||
"properties": {
|
||||
"annotations": {
|
||||
"$ref": "#/definitions/labelSet"
|
||||
@ -3076,6 +2981,7 @@
|
||||
"type": "object"
|
||||
},
|
||||
"gettableAlerts": {
|
||||
"description": "GettableAlerts gettable alerts",
|
||||
"items": {
|
||||
"$ref": "#/definitions/gettableAlert"
|
||||
},
|
||||
@ -3277,7 +3183,6 @@
|
||||
"type": "object"
|
||||
},
|
||||
"receiver": {
|
||||
"description": "Receiver receiver",
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "name",
|
||||
|
@ -2791,101 +2791,6 @@
|
||||
"$ref": "#/definitions/EmbeddedContactPoint"
|
||||
}
|
||||
},
|
||||
"CreateDashboardSnapshotCommand": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"dashboard"
|
||||
],
|
||||
"properties": {
|
||||
"Result": {
|
||||
"$ref": "#/definitions/DashboardSnapshot"
|
||||
},
|
||||
"dashboard": {
|
||||
"$ref": "#/definitions/Json"
|
||||
},
|
||||
"deleteKey": {
|
||||
"description": "Unique key used to delete the snapshot. It is different from the `key` so that only the creator can delete the snapshot. Required if `external` is `true`.",
|
||||
"type": "string"
|
||||
},
|
||||
"expires": {
|
||||
"description": "When the snapshot should expire in seconds in seconds. Default is never to expire.",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"default": 0
|
||||
},
|
||||
"external": {
|
||||
"description": "these are passed when storing an external snapshot ref\nSave the snapshot on an external server rather than locally.",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"key": {
|
||||
"description": "Define the unique key. Required if `external` is `true`.",
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"description": "Snapshot name",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"DashboardSnapshot": {
|
||||
"description": "DashboardSnapshot model",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Created": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"Dashboard": {
|
||||
"$ref": "#/definitions/Json"
|
||||
},
|
||||
"DashboardEncrypted": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "uint8"
|
||||
}
|
||||
},
|
||||
"DeleteKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"Expires": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"External": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"ExternalDeleteUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"ExternalUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"Id": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"Key": {
|
||||
"type": "string"
|
||||
},
|
||||
"Name": {
|
||||
"type": "string"
|
||||
},
|
||||
"OrgId": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"Updated": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"UserId": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
}
|
||||
},
|
||||
"DateTime": {
|
||||
"description": "DateTime is a time but it serializes to ISO8601 format with millis\nIt knows how to read 3 different variations of a RFC3339 date time.\nMost APIs we encounter want either millisecond or second precision times.\nThis just tries to make it worry-free.",
|
||||
"type": "string",
|
||||
@ -5012,9 +4917,8 @@
|
||||
}
|
||||
},
|
||||
"URL": {
|
||||
"description": "The general form represented is:\n\n[scheme:][//[userinfo@]host][/]path[?query][#fragment]\n\nURLs that do not start with a slash after the scheme are interpreted as:\n\nscheme:opaque[?query][#fragment]\n\nNote that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.\nA consequence is that it is impossible to tell which slashes in the Path were\nslashes in the raw URL and which were %2f. This distinction is rarely important,\nbut when it is, the code should use RawPath, an optional field which only gets\nset if the default encoding is different from Path.\n\nURL's String method uses the EscapedPath method to obtain the path. See the\nEscapedPath method for more details.",
|
||||
"type": "object",
|
||||
"title": "A URL represents a parsed URL (technically, a URI reference).",
|
||||
"title": "URL is a custom URL type that allows validation at configuration load time.",
|
||||
"properties": {
|
||||
"ForceQuery": {
|
||||
"type": "boolean"
|
||||
@ -5215,7 +5119,6 @@
|
||||
}
|
||||
},
|
||||
"alertGroup": {
|
||||
"description": "AlertGroup alert group",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"alerts",
|
||||
@ -5240,6 +5143,7 @@
|
||||
"$ref": "#/definitions/alertGroup"
|
||||
},
|
||||
"alertGroups": {
|
||||
"description": "AlertGroups alert groups",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/alertGroup"
|
||||
@ -5348,6 +5252,7 @@
|
||||
"$ref": "#/definitions/Duration"
|
||||
},
|
||||
"gettableAlert": {
|
||||
"description": "GettableAlert gettable alert",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"labels",
|
||||
@ -5404,6 +5309,7 @@
|
||||
"$ref": "#/definitions/gettableAlert"
|
||||
},
|
||||
"gettableAlerts": {
|
||||
"description": "GettableAlerts gettable alerts",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/gettableAlert"
|
||||
@ -5609,7 +5515,6 @@
|
||||
"$ref": "#/definitions/postableSilence"
|
||||
},
|
||||
"receiver": {
|
||||
"description": "Receiver receiver",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -8980,7 +8980,7 @@
|
||||
"$ref": "#/definitions/ScheduleDTO"
|
||||
},
|
||||
"state": {
|
||||
"type": "string"
|
||||
"$ref": "#/definitions/State"
|
||||
},
|
||||
"templateVars": {
|
||||
"type": "object"
|
||||
@ -9450,9 +9450,6 @@
|
||||
"isHome": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isPublic": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isSnapshot": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@ -10054,6 +10051,9 @@
|
||||
"Folder": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"accessControl": {
|
||||
"$ref": "#/definitions/Metadata"
|
||||
},
|
||||
"canAdmin": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@ -10105,6 +10105,9 @@
|
||||
"FolderSearchHit": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"accessControl": {
|
||||
"$ref": "#/definitions/Metadata"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
@ -11701,6 +11704,9 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"State": {
|
||||
"type": "string"
|
||||
},
|
||||
"Status": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
Loading…
Reference in New Issue
Block a user