private static async Task <SwaggerEndpointConfig> DeserializeSwaggerJsonConfig(
            HttpResponseMessage httpResponseMessage)
        {
            var responseString = await GetStringContentFromHttpResponse(httpResponseMessage);

            var hasJsonParsingThrownException           = false;
            SwaggerEndpointConfig swaggerEndpointConfig = null;

            try
            {
                swaggerEndpointConfig = JsonConvert.DeserializeObject <SwaggerEndpointConfig>(responseString);
            }
            catch (Exception)
            {
                hasJsonParsingThrownException = true;
            }

            if (hasJsonParsingThrownException || swaggerEndpointConfig?.Info is null)
            {
                var httpRequestUri = ExtractRequestUri(httpResponseMessage);
                throw new JsonReaderException($"Could not parse the JSON from the Swagger endpoint {httpRequestUri}.");
            }

            return(swaggerEndpointConfig);
        }
        private static SwaggerRuntimeInfo BuildSwaggerRuntimeInfoFromEndpoint(
            SwaggerEndpointConfig swaggerEndpointConfig)
        {
            var swaggerEndpointInfo = swaggerEndpointConfig.Info;

            return(new SwaggerRuntimeInfo
            {
                Title = swaggerEndpointInfo.Title,
                Description = swaggerEndpointInfo.Description,
                Version = swaggerEndpointInfo.Version,
            });
        }