Skip to content

Update swagger-spec to change stream field into type map[string]SomeStruct #3

@carlocayos

Description

@carlocayos

Problem:

In the Gamer Loot response payload, it returns a "streams" object with repeating objects (i.e. loot_season_1, loot_season_2, etc).

{
  "status": "success",
  "data": {
    "streams": {
      "loot_season_1": {
        "name": "loot_season_1",
        "categoryNameLabel": "Season 1",
        "categoryTitleLabel": "Season 1",
        "tier": 0,
        "streamType": "season",
        "rarity": null,
        "lootType": null,
        "seasonInfoUrlKey": "season-1",
        "itemsObtained": null,
        "premiumTokenOwnedNotRedeemed": false,
        "tierSkipTokensUnredeemed": null,
        "premium": false
      },
      "loot_season_0": {
        "name": "loot_season_0",
        "categoryNameLabel": "Season 0",
        "categoryTitleLabel": "Season 0",
        "tier": 0,
        "streamType": "season",
        "rarity": null,
        "lootType": null,
        "seasonInfoUrlKey": "season-0",
        "itemsObtained": null,
        "premiumTokenOwnedNotRedeemed": false,
        "tierSkipTokensUnredeemed": null,
        "premium": false
      }
    }
  }
}

Find a way using go-swagger to autogenerate and represent the streams field as type map[string]SomeStruct

Sample

type SomeStruct struct {
  Name string
  CategoryNameLabel string
  CategoryTitleLabel string
  ...
}

someStruct := streams["loot_season_1"]
someStruct.CategoryNameLabel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions