Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurations with custom fields cause pydantic to choke #25

Open
s2unified opened this issue Feb 26, 2024 · 0 comments
Open

Configurations with custom fields cause pydantic to choke #25

s2unified opened this issue Feb 26, 2024 · 0 comments

Comments

@s2unified
Copy link

s2unified commented Feb 26, 2024

Hi,

When calling my configuration list for domain names it has custom fields in, and this seems to cause pydantic to choke.

Calling configuration = cwm.company.configurations.paginated(1,1000).params={'conditions': 'type/id=55'}

Traceback (most recent call last):
  File "domain-expiry-refresh.py", line 38, in <module>
    configuration = cwm.company.configurations.paginated(1,1000).params={'conditions': 'type/id=55'}
  File "C:\Program Files (x86)\Python311-32\Lib\site-packages\pyconnectwise\endpoints\manage\CompanyConfigurationsEndpoint.py", line 91, in paginated
    return PaginatedResponse(
  File "C:\Program Files (x86)\Python311-32\Lib\site-packages\pyconnectwise\responses\paginated_response.py", line 55, in __init__
    self._initialize(response, response_model, endpoint, page, page_size, params)
  File "C:\Program Files (x86)\Python311-32\Lib\site-packages\pyconnectwise\responses\paginated_response.py", line 101, in _initialize
    self.data: list[TModel] = [
  File "C:\Program Files (x86)\Python311-32\Lib\site-packages\pyconnectwise\responses\paginated_response.py", line 102, in <listcomp>
    response_model.model_validate(d) for d in response.json()
  File "C:\Program Files (x86)\Python311-32\Lib\site-packages\pydantic\main.py", line 509, in model_validate
    return cls.__pydantic_validator__.validate_python(
pydantic_core._pydantic_core.ValidationError: 2 validation errors for CompanyConfiguration
questions.0.answer
  Input should be a valid dictionary [type=dict_type, input_value='configuration_custom_secret_value_1', input_type=str]
    For further information visit https://errors.pydantic.dev/2.6/v/dict_type
questions.1.answer
  Input should be a valid dictionary [type=dict_type, input_value='configuration_custom_secret_value_2, input_type=str]
    For further information visit https://errors.pydantic.dev/2.6/v/dict_type

Hoping this isn't something too weird! I have removed the actual values that were returned as they were confidential and replaced it with configuration_custom_secret_value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant