Exemplo n.º 1
0
        /// <summary>Indicates whether the current object is equal to another object of the same type.</summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns>true if the current object is equal to the <paramref name="other">other</paramref> parameter; otherwise, false.</returns>
        public bool Equals(OasSchema other)
        {
            if (other is null) return false;
            if (ReferenceEquals(this, other)) return true;

            if (JsonType != other.JsonType) return false;
            if (Format != other.Format) return false;
            if (Options != other.Options) return false;
            if (!NumberRange.Equals(other.NumberRange)) return false;
            if (!ItemsRange.Equals(other.ItemsRange)) return false;
            if (!LengthRange.Equals(other.LengthRange)) return false;
            if (!PropertiesRange.Equals(other.PropertiesRange)) return false;
            if (!ExternalDocumentation.Equals(other.ExternalDocumentation)) return false;
            if (!StringComparer.Ordinal.Equals(Title, other.Title)) return false;
            if (!StringComparer.Ordinal.Equals(Description, other.Description)) return false;
            if (!StringComparer.Ordinal.Equals(Pattern, other.Pattern)) return false;
            if (!Enum.NullableSetEquals(other.Enum)) return false;
            if (!AllOf.NullableSetEquals(other.AllOf)) return false;
            if (!OneOf.NullableSetEquals(other.OneOf)) return false;
            if (!AnyOf.NullableSetEquals(other.AnyOf)) return false;
            if (!Not.NullableSetEquals(other.Not)) return false;
            if (Items != other.Items) return false;
            if (!Properties.NullableDictionaryEquals(other.Properties)) return false;
            if (!AdditionalProperties.NullableDictionaryEquals(other.AdditionalProperties)) return false;

            return true;
        }
Exemplo n.º 2
0
 private void ValidateAdditionalProperties(
     JObject jObject,
     List <string> additionalPropertyNames,
     AdditionalProperties additionalProperties)
 {
     if (!additionalProperties.Allowed)
     {
         foreach (string propertyName in additionalPropertyNames)
         {
             JProperty property = jObject.Property(propertyName);
             AddResult(property, ErrorNumber.AdditionalPropertiesProhibited, propertyName);
         }
     }
     else
     {
         // Additional properties are allowed. If there is a schema to which they
         // must conform, ensure that they do.
         if (additionalProperties.Schema != null)
         {
             JsonSchema resolvedSchema = Resolve(additionalProperties.Schema);
             foreach (string propertyName in additionalPropertyNames)
             {
                 JProperty property = jObject.Property(propertyName);
                 ValidateToken(property.Value, resolvedSchema);
             }
         }
     }
 }
Exemplo n.º 3
0
        public void WillBeValidatedBy <TValidationRule>() where TValidationRule : IValidationRule <TViewModel>
        {
            var properties         = new AdditionalProperties();
            var validationRuleType = typeof(TValidationRule).GetGenericTypeDefinition();

            _validationConfiguration.DiscoveredTypes.AddRuleFor(_property, new ValidationRuleSetup(validationRuleType, properties));
        }
Exemplo n.º 4
0
 public override string ToString()
 {
     return
         ($"--------------------------\n" +
          $"Id: {Id}\n" +
          $"Price: {Price}\n" +
          $"Uploader username: {UploaderUsername}\n" +
          $"Upload date: {UploadDate}\n" +
          $"Brand: {Brand}\n" +
          $"Model: {Model}\n" +
          $"Used: {Used}\n" +
          $"Date of purchase: {DateOfPurchase}\n" +
          $"Engine data:\n{Engine}\n" + // print all engine data: volume, hp, kw, type, fuel type
          $"Chassis type: {ChassisType}\n" +
          $"Color: {Color}\n" +
          $"Gearbox type: {GearboxType}\n" + // print all gearbox data: gearbox type, number of gears
          $"Kilometers driven: {TotalKilometersDriven}\n" +
          $"Drive wheels: {DriveWheels}\n" +
          $"Defects:\n{Defects.ToString<string>()}" +
          $"Steering wheel side: {SteeringWheelPosition}\n" +
          $"Number of doors: {NumberOfDoors}\n" +
          $"Seats: {Seats}\n" +
          $"Nex vehicle inspection date: {NextVehicleInspection}\n" +
          $"Wheel size: {WheelSize}\n" +
          $"Weight: {Weight}\n" +
          $"Euro emissions standard: {EuroStandard}\n" +
          $"Origin country: {OriginalPurchaseCountry}\n" +
          $"VIN: {Vin}\n" +
          $"Additional properties: \n{AdditionalProperties.ToString<string>()}" +
          $"Images: {Images.Count} (not shown)\n" +
          $"Comment: {Comment}\n" +
          $"Hidden: {Hidden}\n" +
          $"--------------------------");
 }
Exemplo n.º 5
0
        public override int GetHashCode()
        {
            var hash = Project.GetHashCode();

            hash ^= AdditionalProperties.GetHashCode();
            hash ^= UndefineProperties.GetHashCode();
            return(hash);
        }
Exemplo n.º 6
0
        private void LogRequestAndResponse(IRestResponse response, Stopwatch stopwatch)
        {
            if (Configuration.LoggerConfiguration != null)
            {
                Log.Logger = Configuration.LoggerConfiguration.CreateLogger();
            }

            var uri        = BuildUri(response.Request);
            var properties = new Dictionary <string, object>();

            if (AdditionalProperties?.Any() == true)
            {
                foreach (var item in AdditionalProperties)
                {
                    properties.Add(item.Key, item.Value);
                }
            }

            properties.Add("Agent", "RestSharp");
            properties.Add("ElapsedMilliseconds", stopwatch.ElapsedMilliseconds);
            properties.Add("Method", response.Request.Method.ToString());
            properties.Add("Url", uri.AbsoluteUri);
            properties.Add("Host", uri.Host);
            properties.Add("Path", uri.AbsolutePath);
            properties.Add("Port", uri.Port);
            properties.Add("QueryString", uri.Query);
            properties.Add("Query", GetRequestQueryStringAsObject(response.Request));
            properties.Add("RequestBody", GetRequestBody(response.Request));
            properties.Add("RequestHeaders", GetRequestHeaders(response.Request));
            properties.Add("StatusCode", (int)response.StatusCode);
            properties.Add("StatusCodeFamily", ((int)response.StatusCode).ToString()[0] + "XX");
            properties.Add("StatusDescription", response.StatusDescription?.Replace(" ", ""));
            properties.Add("ResponseStatus", response.ResponseStatus.ToString());
            properties.Add("ProtocolVersion", response.ProtocolVersion);
            properties.Add("IsSuccessful", response.IsSuccessful);
            properties.Add("ErrorMessage", response.ErrorMessage);
            properties.Add("ErrorException", GetResponseException(response.ErrorException));
            properties.Add("ResponseContent", GetResponseContent(response));
            properties.Add("ContentLength", response.ContentLength);
            properties.Add("ContentType", response.ContentType);
            properties.Add("ResponseHeaders", GetResponseHeaders(response));
            properties.Add("Environment", Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"));

            using (LogContext.Push(new RestClientAutologEnricher(properties,
                                                                 GetIgnoredProperties(response.Request), Configuration.PropertiesToDestructure)))
            {
                if (response.IsSuccessful)
                {
                    Log.Information(Configuration.MessageTemplateForSuccess);
                }
                else
                {
                    Log.Error(Configuration.MessageTemplateForError);
                }
            }
        }
Exemplo n.º 7
0
        public RuleExpression WillBeValidatedBy <TValidationRule>(Action <AdditionalPropertyExpression> additionalProperties) where TValidationRule : IValidationRule <CanBeAnyViewModel>
        {
            var properties = new AdditionalProperties();
            var additionalPropertyExpression = new AdditionalPropertyExpression(properties);

            additionalProperties(additionalPropertyExpression);

            _defaultPropertyConvention.AddValidationRule <TValidationRule>(properties);
            return(this);
        }
Exemplo n.º 8
0
        public UiAction(UiComponent other) : base(other)
        {
            const string key = "JobKey";

            if (AdditionalProperties.ContainsKey(key))
            {
                JobKey = AdditionalProperties[key]?.ToString();
                AdditionalProperties.Remove(key);
            }
        }
        public string AdditionalPropertiesTSType()
        {
            string result = "any";

            if (AdditionalProperties != null)
            {
                var type = AdditionalProperties.TSType(true);
                result = type != "any" ? $"{type} | any" : "any";
            }
            return(result);
        }
 Dictionary <string, string> CreateAdditionalProperties()
 {
     if (AdditionalProperties == null)
     {
         return(new Dictionary <string, string>());
     }
     return(AdditionalProperties.Select(kvString => kvString.Split('='))
            .Where(x => x != null && x.Length >= 2)
            .ToDictionary(x => x[0], x => x[1])
            );
 }
Exemplo n.º 11
0
        public void WillBeValidatedBy <TValidationRule>(Action <ExtendedAdditionalPropertyExpression <TViewModel> > additionalProperties) where TValidationRule : IValidationRule <TViewModel>
        {
            var properties = new AdditionalProperties();
            var additionalPropertyExpression = new ExtendedAdditionalPropertyExpression <TViewModel>(properties);

            additionalProperties(additionalPropertyExpression);

            var validationRuleType = typeof(TValidationRule).GetGenericTypeDefinition();

            _validationConfiguration.DiscoveredTypes.AddRuleFor(_property, new ValidationRuleSetup(validationRuleType, properties));
        }
        public override bool Equals(object obj)
        {
            var rhs = obj as JsonObjectValidator;

            if (rhs == null)
            {
                return(false);
            }

            if (Required.Count != rhs.Required.Count)
            {
                return(false);
            }
            if (!Required.OrderBy(x => x).SequenceEqual(rhs.Required.OrderBy(x => x)))
            {
                return(false);
            }

            if (Dependencies.Count != rhs.Dependencies.Count)
            {
                return(false);
            }
            foreach (var kv in Dependencies)
            {
                if (!kv.Value.OrderBy(x => x).SequenceEqual(rhs.Dependencies[kv.Key].OrderBy(x => x)))
                {
                    return(false);
                }
            }

            if (AdditionalProperties == null &&
                rhs.AdditionalProperties == null)
            {
                // ok
            }
            else if (AdditionalProperties == null)
            {
                return(false);
            }
            else if (rhs.AdditionalProperties == null)
            {
                return(false);
            }
            else
            {
                if (!AdditionalProperties.Equals(rhs.AdditionalProperties))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 13
0
 private void Add()
 {
     if (!string.IsNullOrWhiteSpace(PropertyType) && !string.IsNullOrWhiteSpace(PropertyName) && AdditionalProperties.All(e => e.Name != PropertyName))
     {
         AdditionalProperties.Add(new ModelAdditionalProperty
         {
             Type = PropertyType,
             Name = PropertyName
         });
         PropertyName = string.Empty;
     }
 }
Exemplo n.º 14
0
        private void LoadPropeties(string sCsv, ref ListView lvCsvParsed)
        {
            List <AdditionalPropertyDefinition> oAPD = null;
            List <ExtendedPropertyDefinition>   oEPD = null;

            //public List<ExtendedPropertyDefinition> EPD = null;
            //public List<AdditionalPropertyDefinition> APD = null;

            APD = null;
            EPD = null;

            //lvCsvParsed.Items.Clear();

            LoadLvHeaders(ref lvCsvParsed);

            string       sChosenFile   = string.Empty;
            ListViewItem oListViewItem = null;

            sChosenFile = txtIncludeUsersAdditionalPropertiesFile.Text;
            int iCount = 0;

            if (AdditionalProperties.GetAdditionalPropertiesDefinitionsFromString(this.txtCsv.Text, ref oAPD))
            {
                foreach (AdditionalPropertyDefinition o in oAPD)
                {
                    oListViewItem      = new ListViewItem();
                    oListViewItem.Text = o.DescPropertyName;
                    oListViewItem.SubItems.Add(o.PropertyName);
                    oListViewItem.SubItems.Add(o.PropertySetId);  // GUID

                    if (o.PropertyIdIsString == false)
                    {
                        string sVal = "0x" + o.PropertyId.ToString("X");
                        oListViewItem.SubItems.Add(sVal);
                    }
                    else
                    {
                        oListViewItem.SubItems.Add("");   // custom property;
                        //oListViewItem.SubItems.Add(o.PropertySetIdString);   // custom property;
                    }
                    oListViewItem.SubItems.Add(o.PropertySetIdString);
                    oListViewItem.SubItems.Add(o.PropertyType);

                    lvCsvParsed.Items.Add(oListViewItem);
                    iCount++;
                }

                APD = oAPD;
                EPD = oEPD;
            }
        }
Exemplo n.º 15
0
        public void Should_be_able_to_add_aditional_required_properties_to_validation_rule()
        {
            DefaultPropertyConvention defaultPropertyConvention = new DefaultPropertyConvention(x => x.Name.Contains("question"));

            var properties = new AdditionalProperties();
            var expression = new AdditionalPropertyExpression(properties);

            expression.NeedsAdditionalPropertyMatching(p => p.Name.Contains("answer"));
            expression.NeedsAdditionalPropertyMatching(p => !p.Name.Contains("question"));

            defaultPropertyConvention.AddValidationRule <IsRequired <CanBeAnyViewModel> >(properties);

            defaultPropertyConvention.GetValidationRules().Count().ShouldEqual(1);
            defaultPropertyConvention.GetAdditionalPropertiesForRule(defaultPropertyConvention.GetValidationRules().First()).Count().ShouldEqual(2);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Returns true if OrgApacheSlingResourcemergerPickerOverridingInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of OrgApacheSlingResourcemergerPickerOverridingInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrgApacheSlingResourcemergerPickerOverridingInfo other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Pid == other.Pid ||
                     Pid != null &&
                     Pid.Equals(other.Pid)
                     ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Properties == other.Properties ||
                     Properties != null &&
                     Properties.Equals(other.Properties)
                 ) &&
                 (
                     AdditionalProperties == other.AdditionalProperties ||
                     AdditionalProperties != null &&
                     AdditionalProperties.Equals(other.AdditionalProperties)
                 ) &&
                 (
                     BundleLocation == other.BundleLocation ||
                     BundleLocation != null &&
                     BundleLocation.Equals(other.BundleLocation)
                 ) &&
                 (
                     ServiceLocation == other.ServiceLocation ||
                     ServiceLocation != null &&
                     ServiceLocation.Equals(other.ServiceLocation)
                 ));
        }
        /// <summary>
        /// Returns true if ComDayCqWcmCoreImplWCMDeveloperModeFilterInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of ComDayCqWcmCoreImplWCMDeveloperModeFilterInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ComDayCqWcmCoreImplWCMDeveloperModeFilterInfo other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Pid == other.Pid ||
                     Pid != null &&
                     Pid.Equals(other.Pid)
                     ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Properties == other.Properties ||
                     Properties != null &&
                     Properties.Equals(other.Properties)
                 ) &&
                 (
                     AdditionalProperties == other.AdditionalProperties ||
                     AdditionalProperties != null &&
                     AdditionalProperties.Equals(other.AdditionalProperties)
                 ) &&
                 (
                     BundleLocation == other.BundleLocation ||
                     BundleLocation != null &&
                     BundleLocation.Equals(other.BundleLocation)
                 ) &&
                 (
                     ServiceLocation == other.ServiceLocation ||
                     ServiceLocation != null &&
                     ServiceLocation.Equals(other.ServiceLocation)
                 ));
        }
        /// <summary>
        /// Returns true if OrgApacheJackrabbitOakSegmentSegmentNodeStoreServiceInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of OrgApacheJackrabbitOakSegmentSegmentNodeStoreServiceInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrgApacheJackrabbitOakSegmentSegmentNodeStoreServiceInfo other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Pid == other.Pid ||
                     Pid != null &&
                     Pid.Equals(other.Pid)
                     ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Properties == other.Properties ||
                     Properties != null &&
                     Properties.Equals(other.Properties)
                 ) &&
                 (
                     AdditionalProperties == other.AdditionalProperties ||
                     AdditionalProperties != null &&
                     AdditionalProperties.Equals(other.AdditionalProperties)
                 ) &&
                 (
                     BundleLocation == other.BundleLocation ||
                     BundleLocation != null &&
                     BundleLocation.Equals(other.BundleLocation)
                 ) &&
                 (
                     ServiceLocation == other.ServiceLocation ||
                     ServiceLocation != null &&
                     ServiceLocation.Equals(other.ServiceLocation)
                 ));
        }
Exemplo n.º 19
0
        /// <summary>
        /// Returns true if ComDayCqAnalyticsSitecatalystImplSitecatalystHttpClientImplInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of ComDayCqAnalyticsSitecatalystImplSitecatalystHttpClientImplInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ComDayCqAnalyticsSitecatalystImplSitecatalystHttpClientImplInfo other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Pid == other.Pid ||
                     Pid != null &&
                     Pid.Equals(other.Pid)
                     ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Properties == other.Properties ||
                     Properties != null &&
                     Properties.Equals(other.Properties)
                 ) &&
                 (
                     AdditionalProperties == other.AdditionalProperties ||
                     AdditionalProperties != null &&
                     AdditionalProperties.Equals(other.AdditionalProperties)
                 ) &&
                 (
                     BundleLocation == other.BundleLocation ||
                     BundleLocation != null &&
                     BundleLocation.Equals(other.BundleLocation)
                 ) &&
                 (
                     ServiceLocation == other.ServiceLocation ||
                     ServiceLocation != null &&
                     ServiceLocation.Equals(other.ServiceLocation)
                 ));
        }
Exemplo n.º 20
0
        /// <summary>
        /// Returns true if ComAdobeCqAccountApiAccountManagementServiceInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of ComAdobeCqAccountApiAccountManagementServiceInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ComAdobeCqAccountApiAccountManagementServiceInfo other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Pid == other.Pid ||
                     Pid != null &&
                     Pid.Equals(other.Pid)
                     ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Properties == other.Properties ||
                     Properties != null &&
                     Properties.Equals(other.Properties)
                 ) &&
                 (
                     AdditionalProperties == other.AdditionalProperties ||
                     AdditionalProperties != null &&
                     AdditionalProperties.Equals(other.AdditionalProperties)
                 ) &&
                 (
                     BundleLocation == other.BundleLocation ||
                     BundleLocation != null &&
                     BundleLocation.Equals(other.BundleLocation)
                 ) &&
                 (
                     ServiceLocation == other.ServiceLocation ||
                     ServiceLocation != null &&
                     ServiceLocation.Equals(other.ServiceLocation)
                 ));
        }
        /// <summary>
        /// Returns true if ComAdobeGraniteJettySslInternalGraniteSslConnectorFactoryInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of ComAdobeGraniteJettySslInternalGraniteSslConnectorFactoryInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ComAdobeGraniteJettySslInternalGraniteSslConnectorFactoryInfo other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Pid == other.Pid ||
                     Pid != null &&
                     Pid.Equals(other.Pid)
                     ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Properties == other.Properties ||
                     Properties != null &&
                     Properties.Equals(other.Properties)
                 ) &&
                 (
                     AdditionalProperties == other.AdditionalProperties ||
                     AdditionalProperties != null &&
                     AdditionalProperties.Equals(other.AdditionalProperties)
                 ) &&
                 (
                     BundleLocation == other.BundleLocation ||
                     BundleLocation != null &&
                     BundleLocation.Equals(other.BundleLocation)
                 ) &&
                 (
                     ServiceLocation == other.ServiceLocation ||
                     ServiceLocation != null &&
                     ServiceLocation.Equals(other.ServiceLocation)
                 ));
        }
        /// <summary>
        /// Returns true if ComAdobeCqSecurityHcPackagesImplExampleContentHealthCheckInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of ComAdobeCqSecurityHcPackagesImplExampleContentHealthCheckInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ComAdobeCqSecurityHcPackagesImplExampleContentHealthCheckInfo other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Pid == other.Pid ||
                     Pid != null &&
                     Pid.Equals(other.Pid)
                     ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Properties == other.Properties ||
                     Properties != null &&
                     Properties.Equals(other.Properties)
                 ) &&
                 (
                     AdditionalProperties == other.AdditionalProperties ||
                     AdditionalProperties != null &&
                     AdditionalProperties.Equals(other.AdditionalProperties)
                 ) &&
                 (
                     BundleLocation == other.BundleLocation ||
                     BundleLocation != null &&
                     BundleLocation.Equals(other.BundleLocation)
                 ) &&
                 (
                     ServiceLocation == other.ServiceLocation ||
                     ServiceLocation != null &&
                     ServiceLocation.Equals(other.ServiceLocation)
                 ));
        }
Exemplo n.º 23
0
        public UiAction(UiComponent other) : base(other)
        {
            if (other is UiAction otherAction)
            {
                JobKey = otherAction.JobKey;
                return;
            }

            const string key = nameof(JobKey);

            if (AdditionalProperties.ContainsKey(key))
            {
                JobKey = AdditionalProperties[key]?.ToString();
                AdditionalProperties.Remove(key);
            }
        }
Exemplo n.º 24
0
 private string GetMessageFromAdditionalProperties()
 {
     if (AdditionalProperties == null)
     {
         return("Generic error");
     }
     if (AdditionalProperties.TryGetValue("error", out object data))
     {
         var error = JsonConvert.DeserializeObject <OperationError>(data.ToString());
         return(error.Message);
     }
     if (AdditionalProperties.TryGetValue("message", out data))
     {
         return(data.ToString());
     }
     return("Generic message");
 }
Exemplo n.º 25
0
 public CakePublishManager(ClickTwiceManager mgr) : base(mgr.ProjectFilePath)
 {
     Environment             = mgr.Environment;
     FileSystem              = mgr.FileSystem;
     Runner                  = mgr.ProcessRunner;
     ToolLocator             = mgr.ToolLocator;
     BuildAction             = mgr.BuildAction ?? DefaultBuildAction;
     CleanOutputOnCompletion = mgr.CleanOutput;
     Configuration           = mgr.Configuration;
     Platform                = mgr.Platform;
     InputHandlers           = mgr.InputHandlers;
     OutputHandlers          = mgr.OutputHandlers;
     Loggers.AddRange(mgr.Loggers);
     ErrorAction = mgr.ErrorAction;
     if (!string.IsNullOrWhiteSpace(mgr.PublishVersion))
     {
         AdditionalProperties.Add("ApplicationVersion", mgr.PublishVersion);
     }
 }
Exemplo n.º 26
0
        public string AdditionalPropertiesDocumentation()
        {
            string result = "Describes unknown properties. ";

            if (AdditionalProperties != null)
            {
                var type = AdditionalProperties.TSType(true);
                if (type != "any")
                {
                    result += $"The value of an unknown property MUST be of type \"{type}\". Due to valid TS constraints " +
                              $"we have modeled this as a union of `{type} | any`.";
                }
                else
                {
                    result += "The value of an unknown property can be of \"any\" type.";
                }
            }
            return(result);
        }
Exemplo n.º 27
0
        private void CompareProperties(ComparisonContext context, SwaggerObject prior)
        {
            // Additional properties

            if (prior.AdditionalProperties == null && AdditionalProperties != null)
            {
                context.LogBreakingChange(ComparisonMessages.AddedAdditionalProperties);
            }
            else if (prior.AdditionalProperties != null && AdditionalProperties == null)
            {
                context.LogBreakingChange(ComparisonMessages.RemovedAdditionalProperties);
            }
            else if (AdditionalProperties != null)
            {
                context.Push("additionalProperties");
                AdditionalProperties.Compare(context, prior.AdditionalProperties);
                context.Pop();
            }
        }
Exemplo n.º 28
0
        private void btnPickFolderIncludeUsersAdditionalProperties_Click(object sender, EventArgs e)
        {
            List <AdditionalPropertyDefinition> oAPD = null;
            List <ExtendedPropertyDefinition>   oEPD = null;

            string sChosenFile = string.Empty;

            sChosenFile = txtIncludeUsersAdditionalPropertiesFile.Text;

            if (AdditionalProperties.GetAdditionalPropertiesFromCsv(ref sChosenFile, ref oAPD, ref oEPD))
            {
                AdditionalPropertyDefinitions = oAPD;
                ExtendedPropertyDefinitions   = oEPD;

                this.txtIncludeUsersAdditionalPropertiesFile.Text = sChosenFile;
            }

            txtIncludeUsersAdditionalPropertiesFile.Enabled = false;
        }
Exemplo n.º 29
0
        private void CompareProperties(ComparisonContext <ServiceDefinition> context, T prior)
        {
            // Additional properties

            if (prior.AdditionalProperties == null && AdditionalProperties != null)
            {
                context.LogBreakingChange(ComparisonMessages.AddedAdditionalProperties);
            }
            else if (prior.AdditionalProperties != null && AdditionalProperties == null)
            {
                context.LogBreakingChange(ComparisonMessages.RemovedAdditionalProperties);
            }
            else if (AdditionalProperties != null)
            {
                context.PushProperty("additionalProperties");
                AdditionalProperties.Compare(context, prior.AdditionalProperties);
                context.Pop();
            }
        }
Exemplo n.º 30
0
        public IType ToPhpType()
        {
            if (Ref != null)
            {
                return(PHP.Array());
            }
            switch (Type)
            {
            case "string":
                return(PHP.String);

            case "integer":
                switch (Format)
                {
                case "int32":
                    return(PHP.Integer);

                case "int64":
                    return(PHP.String);

                default:
                    throw new Exception("unknown integer format: " + Format);
                }

            case "boolean":
                return(PHP.Boolean);

            case "file":
                return(PHP.String);

            case "array":
                return(PHP.Array(Items.ToPhpType()));

            case "object":
                return(PHP.Array(AdditionalProperties?.ToPhpType()));

            default:
                throw new Exception("unknown swagger type: " + Type);
            }
        }