OAuth2SecurityScheme.fromJson constructor
OAuth2SecurityScheme.fromJson()
Creates a OAuth2SecurityScheme from a json
object.
Implementation
factory OAuth2SecurityScheme.fromJson(
Map<String, dynamic> json,
PrefixMapping prefixMapping,
Set<String> parsedFields,
) {
final description = json.parseField<String>("description", parsedFields);
final descriptions =
json.parseMapField<String>("descriptions", parsedFields);
final jsonLdType = json.parseArrayField<String>("@type");
final proxy = json.parseUriField("proxy", parsedFields);
final authorization =
json.parseField<String>("authorization", parsedFields);
final token = json.parseField<String>("token", parsedFields);
final refresh = json.parseField<String>("refresh", parsedFields);
final scopes =
json.parseArrayField<String>("scopes", parsedFields: parsedFields);
final flow = json.parseRequiredField<String>("flow", parsedFields);
final additionalFields =
json.parseAdditionalFields(prefixMapping, parsedFields);
// TODO: Add validation for the different flow-specific assertions
// https://www.w3.org/TR/wot-thing-description11/#oauth2securityscheme
return OAuth2SecurityScheme(
flow,
description: description,
descriptions: descriptions,
jsonLdType: jsonLdType,
proxy: proxy,
authorization: authorization,
token: token,
refresh: refresh,
scopes: scopes,
additionalFields: additionalFields,
);
}