/// <summary>Initializes a new instance of the <see cref="SwaggerToCSharpClientGenerator" /> class.</summary> /// <param name="document">The Swagger document.</param> /// <param name="settings">The settings.</param> /// <param name="resolver">The resolver.</param> /// <exception cref="ArgumentNullException"><paramref name="document" /> is <see langword="null" />.</exception> public SwaggerToCSharpClientGenerator(SwaggerDocument document, SwaggerToCSharpClientGeneratorSettings settings, SwaggerToCSharpTypeResolver resolver) : base(document, settings, resolver) { if (document == null) throw new ArgumentNullException(nameof(document)); Settings = settings; _document = document; }
/// <summary>Creates a new resolver, adds the given schema definitions and registers an exception schema if available.</summary> /// <param name="settings">The settings.</param> /// <param name="definitions">The definitions.</param> public static SwaggerToCSharpTypeResolver CreateWithDefinitions(CSharpGeneratorSettings settings, IDictionary<string, JsonSchema4> definitions) { var exceptionSchema = definitions.ContainsKey("Exception") ? definitions["Exception"] : null; var resolver = new SwaggerToCSharpTypeResolver(settings, exceptionSchema); resolver.AddGenerators(definitions .Where(p => p.Value != exceptionSchema) .ToDictionary(p => p.Key, p => p.Value)); return resolver; }
/// <summary>Creates a new resolver, adds the given schema definitions and registers an exception schema if available.</summary> /// <param name="settings">The settings.</param> /// <param name="definitions">The definitions.</param> public static SwaggerToCSharpTypeResolver CreateWithDefinitions(CSharpGeneratorSettings settings, IDictionary <string, JsonSchema4> definitions) { var exceptionSchema = definitions.ContainsKey("Exception") ? definitions["Exception"] : null; var resolver = new SwaggerToCSharpTypeResolver(settings, exceptionSchema); resolver.AddSchemas(definitions .Where(p => p.Value != exceptionSchema) .ToDictionary(p => p.Key, p => p.Value)); return(resolver); }
internal SwaggerToCSharpGeneratorBase(SwaggerService service, SwaggerToCSharpGeneratorSettings settings) { _service = service; _settings = settings; foreach (var definition in _service.Definitions.Where(p => string.IsNullOrEmpty(p.Value.TypeNameRaw))) { definition.Value.TypeNameRaw = definition.Key; } var exceptionSchema = _service.Definitions.ContainsKey("Exception") ? _service.Definitions["Exception"] : null; Resolver = new SwaggerToCSharpTypeResolver(settings.CSharpGeneratorSettings, exceptionSchema); Resolver.AddSchemas(service.Definitions.Where(p => p.Value != exceptionSchema).ToDictionary(p => p.Key, p => p.Value)); }
/// <summary>Initializes a new instance of the <see cref="SwaggerToCSharpClientGenerator" /> class.</summary> /// <param name="service">The service.</param> /// <param name="settings">The settings.</param> /// <param name="resolver">The resolver.</param> /// <exception cref="ArgumentNullException"><paramref name="service" /> is <see langword="null" />.</exception> public SwaggerToCSharpClientGenerator(SwaggerService service, SwaggerToCSharpClientGeneratorSettings settings, SwaggerToCSharpTypeResolver resolver) : base(service, settings, resolver) { if (service == null) { throw new ArgumentNullException(nameof(service)); } Settings = settings; _service = service; foreach (var definition in _service.Definitions.Where(p => string.IsNullOrEmpty(p.Value.TypeNameRaw))) { definition.Value.TypeNameRaw = definition.Key; } }
/// <summary>Initializes a new instance of the <see cref="SwaggerToCSharpClientGenerator" /> class.</summary> /// <param name="service">The service.</param> /// <param name="settings">The settings.</param> /// <exception cref="System.ArgumentNullException">service</exception> /// <exception cref="ArgumentNullException"><paramref name="service" /> is <see langword="null" />.</exception> public SwaggerToCSharpClientGenerator(SwaggerService service, SwaggerToCSharpClientGeneratorSettings settings) : this(service, settings, SwaggerToCSharpTypeResolver.CreateWithDefinitions(settings.CSharpGeneratorSettings, service.Definitions)) { }
internal SwaggerToCSharpGeneratorBase(SwaggerDocument document, SwaggerToCSharpGeneratorSettings settings, SwaggerToCSharpTypeResolver resolver) : base(resolver, settings.CodeGeneratorSettings) { _document = document; _settings = settings; }
internal SwaggerToCSharpGenerator(SwaggerService service, CSharpGeneratorSettings settings) { Resolver = new SwaggerToCSharpTypeResolver(settings, service.Definitions); }
internal SwaggerToCSharpGeneratorBase(SwaggerDocument document, SwaggerToCSharpGeneratorSettings settings, SwaggerToCSharpTypeResolver resolver) : base(resolver, settings.CodeGeneratorSettings) { _document = document; _settings = settings; foreach (var definition in _document.Definitions.Where(p => string.IsNullOrEmpty(p.Value.TypeNameRaw))) { definition.Value.TypeNameRaw = definition.Key; } }
/// <summary>Initializes a new instance of the <see cref="SwaggerToCSharpWebApiControllerGenerator" /> class.</summary> /// <param name="document">The Swagger document.</param> /// <param name="settings">The settings.</param> /// <param name="resolver">The resolver.</param> /// <exception cref="ArgumentNullException"><paramref name="document" /> is <see langword="null" />.</exception> public SwaggerToCSharpWebApiControllerGenerator(SwaggerDocument document, SwaggerToCSharpWebApiControllerGeneratorSettings settings, SwaggerToCSharpTypeResolver resolver) : base(document, settings, resolver) { if (document == null) { throw new ArgumentNullException(nameof(document)); } Settings = settings; _document = document; }
/// <summary>Initializes a new instance of the <see cref="SwaggerToCSharpWebApiControllerGenerator" /> class.</summary> /// <param name="document">The Swagger document.</param> /// <param name="settings">The settings.</param> /// <exception cref="ArgumentNullException"><paramref name="document" /> is <see langword="null" />.</exception> public SwaggerToCSharpWebApiControllerGenerator(SwaggerDocument document, SwaggerToCSharpWebApiControllerGeneratorSettings settings) : this(document, settings, SwaggerToCSharpTypeResolver.CreateWithDefinitions(settings.CSharpGeneratorSettings, document.Definitions)) { }
internal SwaggerToCSharpGenerator(SwaggerService service, CSharpGeneratorSettings settings) { Resolver = new SwaggerToCSharpTypeResolver(settings, service.Definitions); }
/// <summary>Initializes a new instance of the <see cref="SwaggerToCSharpWebApiControllerGenerator" /> class.</summary> /// <param name="document">The Swagger document.</param> /// <param name="settings">The settings.</param> /// <param name="resolver">The resolver.</param> /// <exception cref="ArgumentNullException"><paramref name="document" /> is <see langword="null" />.</exception> public SwaggerToCSharpWebApiControllerGenerator(SwaggerDocument document, SwaggerToCSharpWebApiControllerGeneratorSettings settings, SwaggerToCSharpTypeResolver resolver) : base(document, settings, resolver) { if (document == null) { throw new ArgumentNullException(nameof(document)); } Settings = settings; _document = document; foreach (var definition in _document.Definitions.Where(p => string.IsNullOrEmpty(p.Value.TypeNameRaw))) { definition.Value.TypeNameRaw = definition.Key; } }
internal SwaggerToCSharpGeneratorBase(SwaggerService service, SwaggerToCSharpGeneratorSettings settings, SwaggerToCSharpTypeResolver resolver) : base(resolver) { _service = service; _settings = settings; foreach (var definition in _service.Definitions.Where(p => string.IsNullOrEmpty(p.Value.TypeNameRaw))) { definition.Value.TypeNameRaw = definition.Key; } }
internal SwaggerToCSharpGeneratorBase(SwaggerDocument document, SwaggerToCSharpGeneratorSettings settings, SwaggerToCSharpTypeResolver resolver) : base(resolver, settings.CodeGeneratorSettings) { _document = document; _settings = settings; }