Page MenuHomePhabricator

๐Ÿ Use snake_case in Wikibase REST API JSON output fields
Closed, ResolvedPublic3 Estimated Story Points

Description

Format used in JSON input and output of Wikibase REST API uses kebab-case spelling for fields that have multiple-word names, e.g. ...property.data-type.
This format is quite inconvenient to work with for a number of programming languages, incl. JavaScript.
Let's use a format that is equally readable but better to work with for programmers. Fields with names consisting of multiple words should use underscore as a word delimiting character ("snake case")

Fields to adjust (list might be incomplete):

  • property.data-type -> property.data_type (in statement, qualifier etc data)
  • data-type -> data_type (top-level field in data of a property)

    "language codes" defined in Medawiki/Wikibase that use dash in the identifier. (e.g. zh-hans, pt-br) to be kept as is. Those are used as JSON field labels

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptJun 21 2024, 8:31 AM

Polishing - Keep language codes with the hyphen and use underscore to change data-type to data_type.

Change #1056175 had a related patch set uploaded (by Jakob; author: Jakob):

[mediawiki/extensions/Wikibase@master] REST: Rename data-type to data_type

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

Change #1056175 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] REST: Rename data-type to data_type

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

Ollie.Shotton_WMDE renamed this task from Use snake_case in Wikibase REST API JSON output fields to ๐Ÿ Use snake_case in Wikibase REST API JSON output fields.Jul 31 2024, 10:58 AM