dwavesystems / dwave-cloud-client

A minimal implementation of the REST interface used to communicate with D-Wave Solver API (SAPI) servers.
https://docs.ocean.dwavesys.com/projects/cloud-client/en/stable/
Apache License 2.0
59 stars 40 forks source link

Enforce API response version validation #541

Closed randomir closed 1 year ago

randomir commented 1 year ago

Implement D-Wave API response data format and version validation for every REST API resource method implemented in dwave.cloud.api.resources.*, i.e. Regions, Solvers and Problems.

For now, don't be strict -- skip the check if the response omits Content-Type (media type). We might want to implement a strict mode later.

In case the client receives an unsupported response version, we fail with ResourceBadResponseError, prompting the user to upgrade the client.

codecov-commenter commented 1 year ago

Codecov Report

Merging #541 (e47d30a) into master (a8c0192) will increase coverage by 0.16%. The diff coverage is 97.56%.

:exclamation: Current head e47d30a differs from pull request most recent head f09db69. Consider uploading reports for the commit f09db69 to get more accurate results

@@            Coverage Diff             @@
##           master     #541      +/-   ##
==========================================
+ Coverage   86.37%   86.54%   +0.16%     
==========================================
  Files          24       24              
  Lines        3384     3456      +72     
==========================================
+ Hits         2923     2991      +68     
- Misses        461      465       +4     
Impacted Files Coverage Δ
dwave/cloud/api/client.py 91.85% <ø> (ø)
dwave/cloud/api/resources.py 94.58% <97.50%> (+1.34%) :arrow_up:
dwave/cloud/api/constants.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more