TParameter.fromJson constructor
Creates a TParameter instance from a decoded OpenAPI Parameter JSON.
Parses name, in, schema, required, type (when present),
allowEmptyValue, example, and format.
Implementation
factory TParameter.fromJson(Map<String, dynamic> json) {
return TParameter(
name: json["name"] ?? "",
inn: json["in"] ?? "query",
schema:
json["schema"] == null ? null : TProperty.fromJson(json["schema"]),
required: json["required"] ?? false,
type: TPropertyType.values.firstWhere(
(e) => e.toString() == json['type']?.toString(),
orElse: () => TPropertyType.string,
),
allowEmptyValue: json["allowEmptyValue"] ?? false,
example: json["example"],
format: json['format'] as String?,
);
}