Skip to content

Validation Errors for get_games and get_player_season_stats (v5.6.11) #17

@StoinkAI

Description

@StoinkAI

I'm using the cfbd-python library (version 5.6.11) to fetch college football data for a project. I'm encountering validation errors when calling certain functions for multiple recent seasons. More info below, thank you!

Environment:

  • cfbd-python version: 5.6.11
  • Python version: 3.11.9
  • Operating System: Windows 11 Pro

Problem Description:

  1. get_games errors: When calling GamesApi().get_games(year=YYYY, season_type='regular') for years 2023, 2022, and 2019, I consistently get validation errors like:

    Validation/Type error during schedule fetching: 9 validation errors for Game
    seasonType  none is not an allowed value (type=type_error.none.not_allowed)
    startDate   none is not an allowed value (type=type_error.none.not_allowed)
    # (Include the other field names listed in your error output) 
    awayTeam    none is not an allowed value (type=type_error.none.not_allowed)
    

    This happens even when fetching data for the full year without specific team/conference filters.

  2. get_player_season_stats errors: When calling StatsApi().get_player_season_stats(year=YYYY, season_type='regular', category='passing') for years 2023, 2022, and 2019, I consistently get a validation error like:

    Validation/Type error during player stat fetching: 1 validation error for PlayerStat
    season  none is not an allowed value (type=type_error.none.not_allowed)
    

    This happens even when fetching data without specific team/conference filters.

It seems the library's data models might not be handling potential null/None values returned by the API for these fields in recent years' data.

Steps to Reproduce (Example):

# Assuming API_CLIENT is configured correctly using cfbd version 5.6.11
try:
    games_api = cfbd.GamesApi(API_CLIENT)
    games_response = games_api.get_games(year=2022, season_type='regular') 
    # Error occurs here or during processing/conversion of games_response
    print("Fetched games successfully?") 
except Exception as e:
    print(f"Error fetching games: {e}") 

try:
    stats_api = cfbd.StatsApi(API_CLIENT)
    stats_response = stats_api.get_player_season_stats(year=2022, category='passing')
    # Error occurs here or during processing/conversion of stats_response
    print("Fetched stats successfully?")
except Exception as e:
    print(f"Error fetching stats: {e}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions