Alien6-Studio / outerspace-apizr

OuterSpace APIzr
https://apizr.outerspace.sh/
3 stars 0 forks source link

[BUG] List index out of range" Error on Handling `Callable` Annotation in FastApizr #7

Open Coopyrightdmin opened 1 year ago

Coopyrightdmin commented 1 year ago

Bug Report

Steps to reproduce

  1. Run FastApizr with a JSON, which includes a function with a Callable annotation without specific arguments.
  2. Observe the error logs produced.

Actual Result

FastApizr throws a "list index out of range" error when attempting to analyze the Callable annotation without specific arguments.

Expected Result

FastApizr should correctly handle the Callable annotation even when no specific arguments are provided. If specific arguments are required, a more descriptive error or warning should be produced.

Additional context

The error seems to originate from the get_annotation_fields method within modelGenerator.py when accessing annotation.of[0] without prior length-checking of annotation.of. This suggests that the code doesn't properly handle Callable annotations without specific arguments.