public NormalizationContext(NormalizationContext ctx) : this() { if (ctx.Enums.Any()) { Enums.AddRange(ctx.Enums); } if (ctx.Models.Any()) { Models.AddRange(ctx.Models); } if (ctx.Operations.Any()) { Operations.AddRange(ctx.Operations); } }
private LifecycleContext(string apiNamespace, string modelNamespace, SwaggerJsonLoader loader, SwaseyOperationWriter operationWriter, SwaseyEnumWriter enumWriter, SwaseyModelWriter modelWriter) { ApiNamespace = apiNamespace ?? Defaults.DefaultApiNamespace; ModelNamespace = modelNamespace ?? Defaults.DefaultModelNamespace; ServiceMetadata = new ServiceMetadata(ApiNamespace, ModelNamespace); ServiceDefinition = new ServiceDefinition(); Loader = loader ?? Defaults.DefaultSwaggerJsonLoader; OperationWriter = operationWriter ?? Defaults.DefaultSwaseyOperationWriter; EnumWriter = enumWriter ?? Defaults.DefaultSwaseyEnumWriter; ModelWriter = modelWriter ?? Defaults.DefaultSwaseyModelWriter; ApiPathJsonMapping = new Dictionary<string, dynamic>(); NormalizationContext = new NormalizationContext(); }
internal LifecycleContext(ILifecycleContext copyFrom) : this(copyFrom.ApiNamespace, copyFrom.ModelNamespace, copyFrom.Loader, copyFrom.OperationWriter, copyFrom.EnumWriter, copyFrom.ModelWriter) { State = copyFrom.State; ResourceListingUri = copyFrom.ResourceListingUri; ApiEnumTemplate = copyFrom.ApiEnumTemplate; ApiModelTemplate = copyFrom.ApiModelTemplate; ApiOperationTemplate = copyFrom.ApiOperationTemplate; SwaggerVersion = copyFrom.SwaggerVersion; ResourceListingJson = copyFrom.ResourceListingJson; OperationFilter = copyFrom.OperationFilter ?? Defaults.DefaultOperationFilter; OperationParameterFilter = copyFrom.OperationParameterFilter ?? Defaults.DefaultOperationParameterFilter; NormalizationContext = new NormalizationContext(copyFrom.NormalizationContext); ServiceDefinition = new ServiceDefinition(copyFrom.ServiceDefinition); copyFrom.ApiPathJsonMapping.ToList().ForEach(x => ApiPathJsonMapping.Add(x.Key, x.Value)); }