コード例 #1
0
        /// <summary>
        /// Create an API builder. The builder is used to build API and operations out of SwaggerDocument.
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="setting"></param>
        /// <returns>API builder</returns>
        public static APIBuilder GetBuilder(AbstractSwaggerReader reader, APIBuilderSetting setting = null)
        {
            if (reader == null)
            {
                throw new SwaggerResourceException("SwaggerReader cannot be null");
            }
            if (reader.GetSwaggerObject() == null)
            {
                throw new SwaggerResourceException("SwaggerDocument cannot be null");
            }

            APIBuilder builder = new APIBuilder()
            {
                _swagger = reader.GetSwaggerObject(),
                _setting = (setting == null) ? new APIBuilderSetting() : setting,
            };

            return(builder);
        }
コード例 #2
0
        /// <summary>
        /// Get an API Builder. The builder is used to build an API and operations.
        /// </summary>
        /// <param name="swaggerURL"></param>
        /// <param name="setting"></param>
        /// <returns></returns>
        public static APIBuilder GetBuilder(string swaggerURL, APIBuilderSetting setting = null)
        {
            AbstractSwaggerReader reader = new SwaggerUrlReader(swaggerURL);

            return(GetBuilder(reader, setting));
        }