JSON API mixes null and empty strings for missing URLs

Open
#422 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
api

Research direction

Start by tracing the API serialization for list_archive_url, webscm_url, and the other nullable URL fields mentioned in the issue. Determine whether the null-versus-empty behavior is controlled by DRF or Patchwork, then verify that nullable URLs consistently produce null and that the behavior is covered by the relevant API tests.

Written by the indexing model from the issue text.

Description

api bug

This is in quite a few places.

list_archive_url is null (though it can be "" too! not sure what the correlation is), most other nullable URLs i.e. webscm_url are "".

I believe the best option is to have them all be null, avoiding cases where a JSON parser knows a field should contain a URL, finds a value (since it's not null), and can't parse it as a valid URL.

Also not sure if this is a DRF quirk or something Patchwork can control.

Dominant language
Python
Stars
317
Forks
91
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from getpatchwork/patchwork

All issues in getpatchwork/patchwork

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.