azure-functions-python-worker icon indicating copy to clipboard operation
azure-functions-python-worker copied to clipboard

[Bug] Incorrect types in cosmos_db_trigger decorator

Open syberen opened this issue 1 year ago • 3 comments

Expected Behavior

When using the start_from_time and start_from_beginning parameters, no typing errors should occur.

Actual Behavior

These fields (start_from_time and start_from_beginning ) are both typed as Optional[time]. It seems to me like it should be:

start_from_beginning: Optional[bool] = None,
start_from_time: Optional[str] = None, <-- is this str or datetime? It is unclear to me

Also, the fields are not correctly documented in microsoft learn: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-cosmosdb-v2-trigger?tabs=python-v2%2Cisolated-process%2Cextensionv4%2Cnodejs-v4&pivots=programming-language-python#example

Steps to Reproduce

Go to this link and you will see the incorrect types

Relevant code being tried


Relevant log output


requirements.txt file


Where are you facing this problem?

Local - Core Tools

Function app name

No response

Additional Information

No response

syberen avatar Nov 11 '24 15:11 syberen

Hi @syberen Thanks for reporting lease share the repro steps.

bhagyshricompany avatar Nov 18 '24 08:11 bhagyshricompany

@bhagyshricompany I've updated the issue with the place where you can find the issue

syberen avatar Nov 18 '24 15:11 syberen

Hi @syberen, thanks for the catch. start_from_beginning should be bool, and start_from_time should be str. I've linked a PR with these changes. However, since we're currently in a release freeze with the holidays and this is a minor fix, release ETA is January.

The properties are mentioned in the documentation linked, but they're under the Configuration section. I agree though that the wording for the Decorators and Configuration sections is misleading. I'll work to get that updated, so that the V1 and V2 properties are accurately displayed.

hallvictoria avatar Nov 18 '24 22:11 hallvictoria