decode method

void decode(
  1. KeyedArchive object
)
override

Implementation

void decode(KeyedArchive object) {
  super.decode(object);

  type = APISecuritySchemeTypeCodec.decode(object.decode("type"));
  description = object.decode("description");

  switch (type) {
    case APISecuritySchemeType.apiKey:
      {
        name = object.decode("name");
        location = APIParameterLocationCodec.decode(object.decode("in"));
      }
      break;
    case APISecuritySchemeType.oauth2:
      {
        flows = object.decodeObjectMap(
            "flows", () => APISecuritySchemeOAuth2Flow.empty());
      }
      break;
    case APISecuritySchemeType.http:
      {
        scheme = object.decode("scheme");
        format = object.decode("bearerFormat");
      }
      break;
    case APISecuritySchemeType.openID:
    case APISecuritySchemeType.openIdConnect:
      {
        connectURL = object.decode("openIdConnectUrl");
      }
      break;
    default:
      throw ArgumentError(
          "APISecurityScheme must have non-null values for: 'type' ${object.decode("type")}.");
  }
}