Skip to content

Commit

Permalink
fix: reflect expected integers in swagger doc (argoproj#13046)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
  • Loading branch information
crenshaw-dev authored and tesla59 committed Dec 16, 2023
1 parent dce6622 commit cc559c3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 35 deletions.
68 changes: 34 additions & 34 deletions assets/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -4036,7 +4036,7 @@
"type": "object",
"properties": {
"expiresIn": {
"type": "string",
"type": "integer",
"format": "int64",
"title": "expiresIn represents a duration in seconds"
},
Expand All @@ -4063,14 +4063,14 @@
"type": "object",
"properties": {
"expiresAt": {
"type": "string",
"type": "integer",
"format": "int64"
},
"id": {
"type": "string"
},
"issuedAt": {
"type": "string",
"type": "integer",
"format": "int64"
}
}
Expand Down Expand Up @@ -4162,7 +4162,7 @@
"type": "boolean"
},
"id": {
"type": "string",
"type": "integer",
"format": "int64"
},
"name": {
Expand Down Expand Up @@ -4626,7 +4626,7 @@
"type": "string"
},
"type": {
"type": "string",
"type": "integer",
"format": "int64"
}
}
Expand Down Expand Up @@ -4765,7 +4765,7 @@
"type": "string"
},
"expiresIn": {
"type": "string",
"type": "integer",
"format": "int64",
"title": "expiresIn represents a duration in seconds"
},
Expand Down Expand Up @@ -5356,7 +5356,7 @@
"type": "string"
},
"remainingItemCount": {
"type": "string",
"type": "integer",
"format": "int64",
"title": "remainingItemCount is the number of subsequent items in the list which are not included in this\nlist response. If the list request contained label or field selectors, then the number of\nremaining items is unknown and the field will be left unset and omitted during serialization.\nIf the list is complete (either because it is not chunking or because this is the last chunk),\nthen there are no more remaining items and this field will be left unset and omitted during\nserialization.\nServers older than v1.15 do not set this field.\nThe intended use of the remainingItemCount is *estimating* the size of a collection. Clients\nshould not rely on the remainingItemCount to be set or to be exact.\n+optional"
},
Expand Down Expand Up @@ -5434,7 +5434,7 @@
},
"seconds": {
"description": "Represents seconds of UTC time since Unix epoch\n1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n9999-12-31T23:59:59Z inclusive.",
"type": "string",
"type": "integer",
"format": "int64"
}
}
Expand Down Expand Up @@ -5504,7 +5504,7 @@
"$ref": "#/definitions/v1Time"
},
"deletionGracePeriodSeconds": {
"type": "string",
"type": "integer",
"format": "int64",
"title": "Number of seconds allowed for this object to gracefully terminate before\nit will be removed from the system. Only set when deletionTimestamp is also set.\nMay only be shortened.\nRead-only.\n+optional"
},
Expand All @@ -5523,7 +5523,7 @@
"type": "string"
},
"generation": {
"type": "string",
"type": "integer",
"format": "int64",
"title": "A sequence number representing a specific generation of the desired state.\nPopulated by the system. Read-only.\n+optional"
},
Expand Down Expand Up @@ -6481,7 +6481,7 @@
},
"revisionHistoryLimit": {
"description": "RevisionHistoryLimit limits the number of items kept in the application's revision history, which is used for informational purposes as well as for rollbacks to previous versions.\nThis should only be changed in exceptional circumstances.\nSetting to zero will store no history. This will reduce storage used.\nIncreasing will increase the space used to store the history, so we do not recommend increasing it.\nDefault is 10.",
"type": "string",
"type": "integer",
"format": "int64"
},
"source": {
Expand Down Expand Up @@ -6631,7 +6631,7 @@
"title": "Duration is the amount to back off. Default unit is seconds, but could also be a duration (e.g. \"2m\", \"1h\")"
},
"factor": {
"type": "string",
"type": "integer",
"format": "int64",
"title": "Factor is a factor to multiply the base duration after each failed retry"
},
Expand Down Expand Up @@ -6742,7 +6742,7 @@
},
"shard": {
"description": "Shard contains optional shard number. Calculated on the fly by the application controller if not specified.",
"type": "string",
"type": "integer",
"format": "int64"
}
}
Expand All @@ -6752,15 +6752,15 @@
"title": "ClusterCacheInfo contains information about the cluster cache",
"properties": {
"apisCount": {
"type": "string",
"type": "integer",
"format": "int64",
"title": "APIsCount holds number of observed Kubernetes API count"
},
"lastCacheSyncTime": {
"$ref": "#/definitions/v1Time"
},
"resourcesCount": {
"type": "string",
"type": "integer",
"format": "int64",
"title": "ResourcesCount holds number of observed Kubernetes resources"
}
Expand Down Expand Up @@ -6823,7 +6823,7 @@
}
},
"applicationsCount": {
"type": "string",
"type": "integer",
"format": "int64",
"title": "ApplicationsCount is the number of applications managed by Argo CD on the cluster"
},
Expand Down Expand Up @@ -6948,7 +6948,7 @@
"type": "string"
},
"requeueAfterSeconds": {
"type": "string",
"type": "integer",
"format": "int64"
},
"template": {
Expand Down Expand Up @@ -7036,7 +7036,7 @@
"type": "string"
},
"requeueAfterSeconds": {
"type": "string",
"type": "integer",
"format": "int64"
},
"revision": {
Expand Down Expand Up @@ -7168,15 +7168,15 @@
"title": "TODO: describe this type",
"properties": {
"capacity": {
"type": "string",
"type": "integer",
"format": "int64"
},
"requestedByApp": {
"type": "string",
"type": "integer",
"format": "int64"
},
"requestedByNeighbors": {
"type": "string",
"type": "integer",
"format": "int64"
},
"resourceName": {
Expand Down Expand Up @@ -7214,11 +7214,11 @@
"title": "JWTToken holds the issuedAt and expiresAt values of a token",
"properties": {
"exp": {
"type": "string",
"type": "integer",
"format": "int64"
},
"iat": {
"type": "string",
"type": "integer",
"format": "int64"
},
"id": {
Expand Down Expand Up @@ -7417,7 +7417,7 @@
"title": "Phase is the current phase of the operation"
},
"retryCount": {
"type": "string",
"type": "integer",
"format": "int64",
"title": "RetryCount contains time of operation retries"
},
Expand Down Expand Up @@ -7509,7 +7509,7 @@
},
"requeueAfterSeconds": {
"description": "RequeueAfterSeconds determines how long the ApplicationSet controller will wait before reconciling the ApplicationSet again.",
"type": "string",
"type": "integer",
"format": "int64"
},
"template": {
Expand Down Expand Up @@ -7602,7 +7602,7 @@
},
"requeueAfterSeconds": {
"description": "Standard parameters.",
"type": "string",
"type": "integer",
"format": "int64"
},
"template": {
Expand Down Expand Up @@ -7809,12 +7809,12 @@
"title": "GithubAppEnterpriseBaseURL specifies the GitHub API URL for GitHub app authentication. If empty will default to https://api.github.com"
},
"githubAppID": {
"type": "string",
"type": "integer",
"format": "int64",
"title": "GithubAppId specifies the Github App ID of the app used to access the repo for GitHub app authentication"
},
"githubAppInstallationID": {
"type": "string",
"type": "integer",
"format": "int64",
"title": "GithubAppInstallationId specifies the ID of the installed GitHub App for GitHub app authentication"
},
Expand Down Expand Up @@ -7899,12 +7899,12 @@
"title": "GithubAppEnterpriseBaseURL specifies the base URL of GitHub Enterprise installation. If empty will default to https://api.github.com"
},
"githubAppID": {
"type": "string",
"type": "integer",
"format": "int64",
"title": "GithubAppId specifies the ID of the GitHub app used to access the repo"
},
"githubAppInstallationID": {
"type": "string",
"type": "integer",
"format": "int64",
"title": "GithubAppInstallationId specifies the installation ID of the GitHub App used to access the repo"
},
Expand Down Expand Up @@ -8354,7 +8354,7 @@
"type": "string"
},
"syncWave": {
"type": "string",
"type": "integer",
"format": "int64"
},
"version": {
Expand All @@ -8371,7 +8371,7 @@
},
"limit": {
"description": "Limit is the maximum number of attempts for retrying a failed sync. If set to 0, no retries will be performed.",
"type": "string",
"type": "integer",
"format": "int64"
}
}
Expand All @@ -8387,7 +8387,7 @@
"$ref": "#/definitions/v1Time"
},
"id": {
"type": "string",
"type": "integer",
"format": "int64",
"title": "ID is an auto incrementing identifier of the RevisionHistory"
},
Expand Down Expand Up @@ -8480,7 +8480,7 @@
},
"requeueAfterSeconds": {
"description": "Standard parameters.",
"type": "string",
"type": "integer",
"format": "int64"
},
"template": {
Expand Down
4 changes: 3 additions & 1 deletion hack/generate-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ EOF
.definitions.v1alpha1ApplicationSourcePluginParameter.properties.array = {"description":"Array is the value of an array type parameter.","type":"array","items":{"type":"string"}} |
del(.definitions.v1alpha1OptionalArray) |
.definitions.v1alpha1ApplicationSourcePluginParameter.properties.map = {"description":"Map is the value of a map type parameter.","type":"object","additionalProperties":{"type":"string"}} |
del(.definitions.v1alpha1OptionalMap)
del(.definitions.v1alpha1OptionalMap) |
# Output for int64 is incorrect, because it is based on proto definitions, where int64 is a string. In our JSON API, we expect int64 to be an integer. https://github.com/grpc-ecosystem/grpc-gateway/issues/219
(.definitions[]?.properties[]? | select(.type == "string" and .format == "int64")) |= (.type = "integer")
' "${COMBINED_SWAGGER}" | \
jq '.definitions.v1Time.type = "string" | .definitions.v1Time.format = "date-time" | del(.definitions.v1Time.properties)' | \
jq '.definitions.v1alpha1ResourceNode.allOf = [{"$ref": "#/definitions/v1alpha1ResourceRef"}] | del(.definitions.v1alpha1ResourceNode.properties.resourceRef) ' \
Expand Down

0 comments on commit cc559c3

Please sign in to comment.