/// <summary>
        /// Swagger描述
        /// </summary>
        /// <param name="document">Swagger文档</param>
        public Swagger(OpenApiDocument document)
        {
            this.Document = document;
            this.Settings = new HttpApiSettings();

            this.resolver = CSharpGeneratorBase
                            .CreateResolverWithExceptionSchema(this.Settings.CSharpGeneratorSettings, document);
        }
        /// <summary>
        /// Swagger描述
        /// </summary>
        /// <param name="document">Swagger文档</param>
        public OpenApiDoc(OpenApiDocument document)
        {
            Document = document;
            Settings = new HttpApiSettings();

            _resolver = CSharpGeneratorBase
                        .CreateResolverWithExceptionSchema(Settings.CSharpGeneratorSettings, document);
        }
Beispiel #3
0
        /// <summary>
        /// WebApiClient的接口数据模型
        /// </summary>
        /// <param name="className">类名</param>
        /// <param name="operations">swagger操作</param>
        /// <param name="document">swagger文档</param>
        /// <param name="settings">设置项</param>
        public HttpApi(string className, IEnumerable <CSharpOperationModel> operations, OpenApiDocument document,
                       HttpApiSettings settings)
            : base(className, operations, document, settings)
        {
            var tag = document.Tags
                      .FirstOrDefault(item => string.Equals(item.Name, className, StringComparison.OrdinalIgnoreCase));

            TypeName  = $"I{Class}Api";
            Summary   = tag?.Description;
            NameSpace = settings.NameSpace;
        }