コード例 #1
0
        /// <summary>
        /// Gets the enum values, if any, for the specified path for this schema.
        /// </summary>
        /// <param name="flattenedPath">Flattened state path.</param>
        /// <returns>The enum values, or null if not an enum.</returns>
        public ICollection <object> GetEnumValuesForFlattenedPath(string flattenedPath)
        {
            if (StateSchema != null)
            {
                var result = StateSchema.Validator.GetEnumValuesForFlattenedPath(flattenedPath);
                if (result != null)
                {
                    return(result);
                }
            }

            if (CommandSchemas != null && CommandSchemas.Any())
            {
                foreach (var schema in CommandSchemas.Where(x => x.ResultsValidator != null))
                {
                    var result = schema.ResultsValidator.GetEnumValuesForFlattenedPath(flattenedPath);
                    if (result != null)
                    {
                        return(result);
                    }
                }
            }

            return(null);
        }
コード例 #2
0
        /// <summary>
        /// Gets the Google type for the specified path is valid for this schema.
        /// </summary>
        /// <param name="flattenedPath">Flattened state path.</param>
        /// <returns>The <see cref="GoogleType"/> for the specified path.</returns>
        public GoogleType GetGoogleTypeForFlattenedPath(string flattenedPath)
        {
            if (StateSchema != null)
            {
                var result = StateSchema.Validator.GetGoogleTypeForFlattenedPath(flattenedPath);
                if (result != GoogleType.Unknown)
                {
                    return(result);
                }
            }

            if (CommandSchemas != null && CommandSchemas.Any())
            {
                foreach (var schema in CommandSchemas.Where(x => x.ResultsValidator != null))
                {
                    var result = schema.ResultsValidator.GetGoogleTypeForFlattenedPath(flattenedPath);
                    if (result != GoogleType.Unknown)
                    {
                        return(result);
                    }
                }
            }

            return(GoogleType.Unknown);
        }