api icon indicating copy to clipboard operation
api copied to clipboard

[openapi spec] titlesByGender object keys are wrong

Open nev-r opened this issue 3 years ago • 3 comments
trafficstars

spec claims the titlesByGender dictionary is keyed by the DestinyGender enum

"Destiny.Definitions.Records.DestinyRecordTitleBlock": {
  "type": "object",
  "properties": {
    "hasTitle": {
      "type": "boolean"
    },
    "titlesByGender": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "x-dictionary-key": {
        "type": "integer",
        "format": "int32",
        "x-enum-reference": {
          "$ref": "#/components/schemas/Destiny.DestinyGender"
        },
        "x-enum-is-bitmask": false
      }
    },

but it's actually keyed by two string keys named Male and Female

nev-r avatar Jan 02 '22 06:01 nev-r

Looks like the JSON serialization turns the enum value key into the enum name instead of the int32 value.

would a change to the API spec and docs make the most sense here? Filed as TFS 1055852.

jshaffstall-bng avatar Jan 03 '22 16:01 jshaffstall-bng

a spec/doc change feels kindest for existing consumers of the data, and if it were keyed by DestinyGender, it would need 3 values, one for 2 (Unknown)

nev-r avatar Jan 03 '22 16:01 nev-r

We don't have titles for that value, and in this case we don't need the map to be exhaustive for the enum.

jshaffstall-bng avatar Jan 03 '22 16:01 jshaffstall-bng