decode method

  1. @override
void decode(
  1. KeyedArchive json
)

Implementation

@override
void decode(KeyedArchive json) {
  name = json.decode("name");
  description = json.decode("description");
  location = APIParameterLocationCodec.decode(json.decode("in"));
  if (location == APIParameterLocation.path) {
    isRequired = true;
  } else {
    isRequired = json.decode("required") ?? false;
  }

  if (location == APIParameterLocation.body) {
    schema = json.decodeObject("schema", () => APISchemaObject());
  } else {
    super.decode(json);
    allowEmptyValue = json.decode("allowEmptyValue") ?? false;
    if (type == APIType.array) {
      items = json.decodeObject("items", () => APIProperty());
    }
  }
}