google-api-swift-client icon indicating copy to clipboard operation
google-api-swift-client copied to clipboard

Enums typed as strings

Open Mark-McCracken opened this issue 4 years ago • 0 comments

Currently, any enums in documents are typed as strings. For example, the analytics document found here: https://www.googleapis.com/discovery/v1/apis/analytics/v3/rest has the following excerpt at line 3797:

...
        "output": {
         "type": "string",
         "description": "The selected format for the response. Default format is JSON.",
         "enum": [
          "dataTable",
          "json"
         ],
         "enumDescriptions": [
          "Returns the response in Google Charts Data Table format. This is useful in creating visualization using Google Charts.",
          "Returns the response in standard JSON format."
         ],
         "location": "query"
      },
...

This results in the variable being coded as a String? like so:

public var `output`: String?

However it would be better if this were Coded as an enum, to stop users putting in whatever string they wanted, but only strings found in the enum

Mark-McCracken avatar Jan 06 '20 11:01 Mark-McCracken