Description
When a CallbackData schema contains optional fields, unpacking payloads that intentionally omit those fields still emits a warning to stderr/stdout, even though the payload is valid.
This makes it difficult to use optional fields as part of a normal flow, because the library produces noisy logs for expected inputs.
Versions
gramio: 0.8.3
@gramio/callback-data: 0.1.0
Reproduction
import {CallbackData} from 'gramio'
const payload = new CallbackData('example')
.string('attemptId')
.number('firstDigit')
.number('digit', {optional: true})
const packed = payload.pack({
attemptId: 'ABCDEFGHIJKLMNOPQRSTUV',
firstDigit: 7,
})
console.log(packed)
const unpacked = payload.unpack(packed)
console.log(unpacked)
Actual behavior
unpack() succeeds, but an extra warning is logged about the omitted optional field, similar to:
Description
When a
CallbackDataschema contains optional fields, unpacking payloads that intentionally omit those fields still emits a warning to stderr/stdout, even though the payload is valid.This makes it difficult to use optional fields as part of a normal flow, because the library produces noisy logs for expected inputs.
Versions
gramio:0.8.3@gramio/callback-data:0.1.0Reproduction
Actual behavior
unpack()succeeds, but an extra warning is logged about the omitted optional field, similar to: