Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
carlocayos opened this issue Jan 6, 2021 · 0 comments · Fixed by #6
Closed

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

carlocayos opened this issue Jan 6, 2021 · 0 comments · Fixed by #6

Comments

@carlocayos
Copy link
Owner

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
@carlocayos carlocayos linked a pull request Jan 9, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant