public function build($baseUri)
    {
        $this->serviceDescription = null;
        $client = SwaggerClient::factory(['base_uri' => $baseUri]);
        $this->debug('Fetching resource listing from %s', $baseUri);
        $listing = $client->getResources();

        // check this looks like a resource listing
        if (!$listing->isSwagger()) {
            throw new \RuntimeException("This doesn't look like a Swagger spec");
        }
        if (!$listing->getApis()) {
            $this->logger->addAlert("Resource listing doesn't define any APIs");
        }
        // check swagger version
        if (self::SWAGGER_VERSION !== $listing->getSwaggerVersion()) {
            throw new \RuntimeException('Unsupported Swagger version, Swizzle expects '.self::SWAGGER_VERSION);
        }
        // Declared version overrides anything we've set
        if ($version = $listing->getApiVersion()) {
            $this->debug('+ set apiVersion %s', $version);
            $this->setApiVersion($version);
        }
        // Set description if missing from constructor
        if (empty($this->init['description'])) {
            $info = $listing->getInfo();
            $this->init['description'] = $info['description'] ?: $this->init['title'];
        }
        // set base path from docs location if not provided
        if (empty($this->init['baseUri'])) {
            $this->init['baseUri'] = self::mergeUrl('/', $baseUri);
        }
        // no more configs allowed now, Guzzle service gets constructed
        $service = $this->getServiceDescription();
        // ready to pull each api declaration
        foreach ($listing->getApiPaths() as $path) {
            if ($this->delay) {
                usleep($this->delay);
            }
            // @todo do proper path resolution here, allowing a cross-domain spec.
            $path = rtrim(parse_url($baseUri)['path'], '/').'/'.ltrim($path, '/');
            $this->debug('pulling %s ...', $path);
            $apiDeclaration = $client->getDeclaration(compact('path'));
            foreach ($apiDeclaration->getModels() as $model) {
                $this->addModel($model);
            }
            // Ensure a fully qualified base url for this api
            $baseUrl = self::mergeUrl($apiDeclaration->getBasePath(), $service->getBaseUri());
            // add each api against required base url
            foreach ($apiDeclaration->getApis() as $api) {
                $this->addApi($api, $baseUrl);
            }
        }
        $this->debug('finished');
        return $this;
    }