ParameterInfo.fromJson constructor
ParameterInfo.fromJson(})
Implementation
factory ParameterInfo.fromJson(
JsonDecoder jsonDecoder,
String jsonPath,
Object? json, {
ClientUriConverter? clientUriConverter,
}) {
json ??= {};
if (json is! Map) {
throw jsonDecoder.mismatch(jsonPath, "'ParameterInfo'", json);
}
ParameterKind kind;
if (json case {'kind': var encodedKind}) {
kind = ParameterKind.fromJson(
jsonDecoder,
'$jsonPath.kind',
encodedKind,
clientUriConverter: clientUriConverter,
);
} else {
throw jsonDecoder.mismatch(jsonPath, "'kind'", json);
}
String name;
if (json case {'name': var encodedName}) {
name = jsonDecoder.decodeString('$jsonPath.name', encodedName);
} else {
throw jsonDecoder.mismatch(jsonPath, "'name'", json);
}
String type;
if (json case {'type': var encodedType}) {
type = jsonDecoder.decodeString('$jsonPath.type', encodedType);
} else {
throw jsonDecoder.mismatch(jsonPath, "'type'", json);
}
String? defaultValue;
if (json case {'defaultValue': var encodedDefaultValue}) {
defaultValue = jsonDecoder.decodeString(
'$jsonPath.defaultValue',
encodedDefaultValue,
);
}
return ParameterInfo(kind, name, type, defaultValue: defaultValue);
}