anancarv / python-artifactory

Typed interactions with the Jfrog Artifactory REST API
MIT License
55 stars 50 forks source link

Can't list repositories on a private repo #151

Closed jlnabais closed 10 months ago

jlnabais commented 10 months ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Try to list repositories on private artifactory instance (the PC has the certificate installed as root)
    art = Artifactory(url=URL, auth=(USERNAME , API_KEY), verify=False, cert=None, api_version=1)
    repositories = art.repositories.list()
    print(repositories)
  2. See error:
    Traceback (most recent call last):
    File "...", line 30, in <module>
    get_latest_artifactory_commit()
    File "...", line 19, in get_latest_artifactory_commit
    repositories = art.repositories.list()
    File "/opt/homebrew/lib/python3.9/site-packages/pyartifactory/objects/repository.py", line 129, in list
    return [SimpleRepository(**repository) for repository in response.json()]
    File "/opt/homebrew/lib/python3.9/site-packages/pyartifactory/objects/repository.py", line 129, in <listcomp>
    return [SimpleRepository(**repository) for repository in response.json()]
    File "/opt/homebrew/lib/python3.9/site-packages/pydantic/main.py", line 164, in __init__
    __pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__)
    pydantic_core._pydantic_core.ValidationError: 1 validation error for SimpleRepository
    type_
    Field required [type=missing, input_value={'key': 'PRIVATE_REPO...'packageType': 'Docker'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.4/v/missing

Expected behavior Should list repositories

Screenshots N/A

Environment:

2.1.1

Additional context Seems to be a problem when validating SimpleRepository through pydantic but I explicitly passed all the required parameters to the Artifactory contructor, so not sure what 'Field' is 'missing'.

anancarv commented 10 months ago

Well spotted @jlnabais . There is an ongoing PR to fix that #152