encode method

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

Implementation

@override
void encode(KeyedArchive json) {
  json.encode("name", name);
  json.encode("description", description);
  json.encode("in", APIParameterLocationCodec.encode(location));
  json.encode("required", isRequired);

  if (location == APIParameterLocation.body) {
    json.encodeObject("schema", schema);
  } else {
    super.encode(json);
    if (allowEmptyValue) {
      json.encode("allowEmptyValue", allowEmptyValue);
    }
    if (type == APIType.array) {
      json.encodeObject("items", items);
    }
  }
}