Page MenuHomePhabricator

Normalize toolinfo data in API output for easier consumption
Closed, ResolvedPublic

Description

Some notes based on a quick chat with @srishakatux as she tries to use the /api/tools/ data in the frontend:

  • Normalize all the fields that might be input as a bare value or an array of values to be arrays of values on the way out. There are quite a number of "oneOf" fields in the toolinfo json schema spec that need this treatment. Basically we want to make it as easy as possible to create a valid toolinfo.json record for submitting, and we also want to make it as easy as possible to consume the tool data returned from the API. The hard work should stay in the backend system as much as possible.
  • Fix the serializers to transform things stored in JSONFields in the database into proper JSON in the output rather than returning strings encoding JSON data for the consumer to transform.
  • The backend should return a usable image url along with the File page input value for icon (and any other similar fields we may add to the spec in the future).
  • Pre-process the "keywords" value to split on commas and store & return as an array of strings.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
bd808 moved this task from To Do to In Dev/Progress on the User-bd808 board.

Change 643594 had a related patch set uploaded (by BryanDavis; owner: Bryan Davis):
[wikimedia/toolhub@main] api/tools: Expand icon to include link to media

https://gerrit.wikimedia.org/r/643594

Change 643595 had a related patch set uploaded (by BryanDavis; owner: Bryan Davis):
[wikimedia/toolhub@main] api: Add model serializer support for JSONField

https://gerrit.wikimedia.org/r/643595

Change 643594 merged by jenkins-bot:
[wikimedia/toolhub@main] api/tools: Expand icon to include link to media

https://gerrit.wikimedia.org/r/643594

Change 643595 merged by jenkins-bot:
[wikimedia/toolhub@main] api: Add model serializer support for JSONField

https://gerrit.wikimedia.org/r/643595

Change 644330 had a related patch set uploaded (by BryanDavis; owner: Bryan Davis):
[wikimedia/toolhub@main] crawler: Normalize bare values as arrays for storage

https://gerrit.wikimedia.org/r/644330

Change 644331 had a related patch set uploaded (by BryanDavis; owner: Bryan Davis):
[wikimedia/toolhub@main] crawler: Normalize "keywords" to array of strings

https://gerrit.wikimedia.org/r/644331

Change 644330 merged by jenkins-bot:
[wikimedia/toolhub@main] crawler: Normalize bare values as arrays for storage

https://gerrit.wikimedia.org/r/644330

Change 644331 merged by jenkins-bot:
[wikimedia/toolhub@main] crawler: Normalize "keywords" to array of strings

https://gerrit.wikimedia.org/r/644331

bd808 updated the task description. (Show Details)