mirror of
https://github.com/mattermost/mattermost.git
synced 2026-04-27 17:21:09 -04:00
* fix openApi vetting
The underlying mattermost-govet tool effectively hasn't been called for some time, as we weren't checking out and building the spec files to pass. Now that hte API is in the monorepo, build it locally and check against it.
Unfortunately, our API documentation isn't up-to-date, and this PR isn't fixing that. For now, add a discrete `make vet-api` and workflow that won't block the build until the API documentation is back in sync and can be merged into the existing `make vet` directive.
* mattermost-govet: use upstream@new
* fix missing /api/v4 prefix for commands autocomplete suggestion
* document /api/v4/ldap/users/{user_id}/group_sync_memberships
* document /api/v4/groups/{group_id}/restore
* fix /files/{file_id}/public actually at root
* document /api/v4/users/invalid_emails
* fix SetThreadUnreadByPostId
* Revert "fix SetThreadUnreadByPostId"
This reverts commit b16bcc8044.
* Revert "Revert "fix SetThreadUnreadByPostId""
This reverts commit 8bda05dc8a.
* workaround undocumented API endpoints
* remove unnecessary whiteline
* ignore go tool output
---------
Co-authored-by: Mattermost Build <build@mattermost.com>
69 lines
4.5 KiB
Bash
Executable file
69 lines
4.5 KiB
Bash
Executable file
#!/bin/bash
|
|
set -euo pipefail
|
|
IFS=$'\n\t'
|
|
|
|
# Our API vet checks haven't been running for a long time, and there are lots of undocumented APIs.
|
|
# To stem the introduction of new, undocumented APIs while we find time to document the old ones,
|
|
# filter out all the "known issues" to support the automated CI check.
|
|
|
|
API_YAML=$ROOT../api/v4/html/static/mattermost-openapi-v4.yaml
|
|
OUTPUT=$($GO vet -vettool=$GOBIN/mattermost-govet -openApiSync -openApiSync.spec=$API_YAML ./... 2>&1 || true)
|
|
|
|
echo "All output, some ignored"
|
|
echo "========================"
|
|
echo "$OUTPUT"
|
|
|
|
OUTPUT_EXCLUDING_IGNORED=$(echo "$OUTPUT" | grep -Fv \
|
|
-e 'go: downloading' \
|
|
-e 'github.com/mattermost/mattermost/server/v8/channels/api4' \
|
|
-e 'Cannot find /api/v4/channels/members/{user_id}/mark_read method: POST in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/channels/members/{user_id}/mark_read method: POST in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/channels/stats/member_count method: POST in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/channels/{channel_id}/common_teams method: GET in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/channels/{channel_id}/convert_to_channel method: POST in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/cloud/products/selfhosted method: GET in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/cloud/subscription/self-serve-status method: GET in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/cloud/request-trial method: PUT in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/cloud/validate-business-email method: POST in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/cloud/validate-workspace-business-email method: POST in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/cloud/check-cws-connection method: GET in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/cloud/delete-workspace method: DELETE in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/drafts method: POST in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/users/{user_id}/teams/{team_id}/drafts method: GET in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/users/{user_id}/channels/{channel_id}/drafts/{thread_id} method: DELETE in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/users/{user_id}/channels/{channel_id}/drafts method: DELETE in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/exports/{export_name:.+\\.zip}/presign-url method: POST in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/hosted_customer/signup_available method: GET in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/hosted_customer/bootstrap method: POST in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/hosted_customer/customer method: POST in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/hosted_customer/confirm method: POST in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/hosted_customer/confirm-expand method: POST in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/hosted_customer/invoices method: GET in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/hosted_customer/invoices/{invoice_id:in_[A-Za-z0-9]+}/pdf method: GET in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/hosted_customer/subscribe-newsletter method: POST in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/license/review method: POST in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/license/review/status method: GET in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/posts/{post_id}/edit_history method: GET in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/posts/{post_id}/info method: GET in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/posts/search method: POST in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/logs/query method: POST in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/latest_version method: GET in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/system/onboarding/complete method: GET in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/system/onboarding/complete method: POST in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/system/schema/version method: GET in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/usage/teams method: GET in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/users/login/desktop_token method: POST in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/users/notify-admin method: POST in OpenAPI 3 spec.' \
|
|
-e 'Cannot find /api/v4/users/trigger-notify-admin-posts method: POST in OpenAPI 3 spec.' \
|
|
-e "Handler /api/v4/cloud/subscription is defined with method PUT, but it's not in the spec" \
|
|
2>&1 || true)
|
|
|
|
if [[ ! -z "${OUTPUT_EXCLUDING_IGNORED// }" ]]; then
|
|
echo "Failing vet output"
|
|
echo "=================="
|
|
echo "$OUTPUT_EXCLUDING_IGNORED"
|
|
exit 1
|
|
else
|
|
echo "Ignoring above errors."
|
|
exit 0
|
|
fi
|