public static function createFromArray($mediaType, array $data = [])
    {
        $body = new static($mediaType);

        if (isset($data['description'])) {
            $body->setDescription($data['description']);
        }

        if (isset($data['schema'])) {
            $body->setSchema($data['schema']);
        } elseif (isset($data['type'])) {
            $type = ApiDefinition::determineType($data['type'], $data);
            if ($type instanceof ObjectType) {
                $type->inheritFromParent();
            }
            $body->setType($type);
        } else {
            // nothing defined means a default of the any type
            // see https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md/#determine-default-types
            $body->setType(new Type('default'));
        }

        if (isset($data['example'])) {
            $body->addExample($data['example']);
        }

        if (isset($data['examples'])) {
            foreach ($data['examples'] as $example) {
                $body->addExample($example);
            }
        }

        return $body;
    }