Closed GeorgePark closed 10 months ago
Hi!
I tested this on my Artifactory Cloud instance, and found that the JSON returned by the API now uses "real" booleans unlike before (where it used the string "false"
or "true"
for some properties).
Python-Artifactory tries to parse the response as a local repository, but fails the validation because Pydantic doesn't want False
as a value for a str
field, so it then tries to parse it as a virtual repo and finally a remote repo, which is why you get an error for RemoteRepositoryResponse.
Here is the error when parsing the response as a LocalRepositoryResponse:
5 validation errors for LocalRepositoryResponse
enableFileListsIndexing
Input should be a valid string [type=string_type, input_value=False, input_type=bool]
For further information visit https://errors.pydantic.dev/2.4/v/string_type
downloadRedirect
Input should be a valid string [type=string_type, input_value=False, input_type=bool]
For further information visit https://errors.pydantic.dev/2.4/v/string_type
cdnRedirect
Input should be a valid string [type=string_type, input_value=False, input_type=bool]
For further information visit https://errors.pydantic.dev/2.4/v/string_type
blockPushingSchema1
Input should be a valid string [type=string_type, input_value=True, input_type=bool]
For further information visit https://errors.pydantic.dev/2.4/v/string_type
priorityResolution
Input should be a valid string [type=string_type, input_value=False, input_type=bool]
For further information visit https://errors.pydantic.dev/2.4/v/string_type
@anancarv will make a PR soon to fix the str-turned-bool properties.
Describe the bug When creating an Artifactory repository using the create_repo function and a LocalRepository as input, an error is thrown rather than a LocalRepositoryResponse being returned. The local repository is created successfully, but something goes wrong when the create_repo function should return a value.
Error: 3 validation errors for RemoteRepositoryResponse\nrclass\n Input should be <RClassEnum.remote: 'remote'> [type=literal_error, input_value='local', input_type=str]\n For further information visit https://errors.pydantic.dev/2.4/v/literal_error\nurl\n Field required [type=missing, input_value={'key': '..., 'rclass': 'local'}, input_type=dict]\n For further information visit https://errors.pydantic.dev/2.4/v/missing\ncdnRedirect\n Input should be a valid string [type=string_type, input_value=False, input_type=bool]\n For further information visit https://errors.pydantic.dev/2.4/v/string_type")
To Reproduce Steps to reproduce the behavior:
Expected behavior Creation of a local repository and response that the local repository has been created successfully rather than Py.
Environment: OS: Linux (Debian 11) pyartifactory version: 2:1.2 Python version: 3.8