encode method

void encode(
  1. KeyedArchive object
)
override

Implementation

void encode(KeyedArchive object) {
  super.encode(object);

  if (name == null || location == null) {
    throw ArgumentError(
        "APIParameter must have non-null values for: 'name', 'location'.");
  }

  object.encode("name", name);
  object.encode("description", description);
  object.encode("in", APIParameterLocationCodec.encode(location));

  if (location == APIParameterLocation.path) {
    object.encode("required", true);
  } else {
    object.encode("required", _required);
  }

  object.encode("deprecated", _deprecated);

  if (location == APIParameterLocation.query) {
    object.encode("allowEmptyValue", _allowEmptyValue);
  }

  object.encodeObject("schema", schema);
  object.encode("style", style);
  object.encode("explode", _explode);
  object.encode("allowReserved", _allowReserved);
  object.encodeObjectMap("content", content);
}