decode method

void decode(
  1. KeyedArchive json
)

Implementation

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

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