Fix Bot API method parameter parity gaps - #81
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR tightens parity with the current official Telegram Bot API method parameter tables and fixes the confirmed gaps found during the comparison.
The comparison used a locally generated
api.jsonsnapshot from the official Telegram Bot API page (https://core.telegram.org/bots/api). The parity test also accepts thefieldsshape used by the JSON spec downloaded in this repository's API Parity workflow, so local official-page checks and CI checks cover the same method-parameter surface.Gaps found and fixed
editMessageTextnow supports the officialrich_messageparameter viaEditMessageTextConfig.RichMessage.sendPaidMedianow supports the official optionalpayloadparameter viaPaidMediaConfig.Payload.setCustomEmojiStickerSetThumbnailnow serializesCustomEmojiIDascustom_emoji_idinstead of the non-officialpositionkey.setStickerMaskPositionnow serializesMaskPositionasmask_positioninstead of the non-officialkeywordskey.uploadStickerFilenow always uses the official multipart field namestickerfor the uploaded sticker file.Parity test changes
api_parity_test.gonow checks method parameters in addition to method presence and type fields. The new check walks the package AST to collect params emitted byparams()and file fields emitted byfiles(), including promoted embedded config methods and named config fields such asChat ChatConfig.Existing legacy or compatibility-only extra params are allowlisted so the parity test focuses on actionable drift instead of breaking older public surface area.
Compatibility
No source-level breaking changes are intended:
EditMessageTextConfig.RichMessageandPaidMediaConfig.Payload.positionfor custom emoji thumbnail orkeywordsfor mask position) will now send the official keys.uploadStickerFilenow normalizes the multipart file field name tosticker, which is the only official parameter name for that file.Validation
go test ./...go vet ./...go test ./... -run TestAPIParityRegressionFixesgo test -tags api_parity -run '^TestAPIParity' -v .with the JSON spec used by CIgo test -tags api_parity -run '^TestAPIParity' -v .with a localapi.jsongenerated from the official Telegram Bot API page