Map<String, dynamic> asMap()

Source

Map<String, dynamic> asMap() {
  var m = <String, dynamic>{"type": type, "description": description};

  if (type == "basic") {
    /* nothing to do */
  } else if (type == "apiKey") {
    m["name"] = apiKeyName;
    m["in"] = APIParameter.parameterLocationStringForType(apiKeyLocation);
  } else if (type == "oauth2") {
    m["flow"] = stringForFlow(oauthFlow);

    if (oauthFlow == APISecuritySchemeFlow.implicit ||
        oauthFlow == APISecuritySchemeFlow.authorizationCode) {
      m["authorizationUrl"] = authorizationURL;
    }

    if (oauthFlow != APISecuritySchemeFlow.implicit) {
      m["tokenUrl"] = tokenURL;
    }

    m["scopes"] = new Map.fromIterable(scopes,
        key: (APISecurityScope k) => k.name,
        value: (APISecurityScope v) => v.description);
  }

  return m;
}