PATCH cannot set creator on a device, dataset or collection

Open Beginner friendly
#269 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
fastapi, python
Domain
api, backend

Research direction

Locate DeviceUpdate, DatasetUpdate and CollectionUpdate, then read DescriptiveMixin and the related PATCH tests. Add a regression test for each model showing that PATCH updates creator; the issue describes deriving the descriptive fields from the mixin while keeping other optional fields explicit. Done when all three PATCH requests persist the new creator.

Written by the indexing model from the issue text.

Description

api metadata
What happened

creator can be set when a device, dataset or collection is registered, but never changed afterwards. DeviceUpdate, DatasetUpdate and CollectionUpdate each list title, description and publisher by hand and leave out creator, which DescriptiveMixin defines alongside them. A PATCH that sends creator is accepted and the value is dropped.

A citation built from these records (#38) would show whatever creator was set at registration, with no way to correct it.

Steps to reproduce
curl -X PATCH -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"creator": "A. Physicist"}' "$API/v1/devices/mast"
# 200, and the response's creator is unchanged

The same holds for PATCH /v1/datasets/{id} and PATCH /v1/collections/{id}.

Version

de9f670 (main)

Fix

Derive the update models' descriptive fields from DescriptiveMixin, so all four are optional on PATCH and a field added to the mixin later reaches them too. Keep the other fields as explicit optional declarations, since the base models make several of them required. Add a regression test per model that a PATCH sets creator.

Split out of #48.

Dominant language
Python
Stars
0
Forks
3
Avg merge
1d 11h
Merged PRs (30d)
57

Getting set up

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 ukaea/fds

All issues in ukaea/fds

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.