Example #1
0
        public YamlSchema BaseYamlSchema()
        {
            if (_baseSchema != null)
            {
                return(_baseSchema);
            }

            const string baseSchemaName = "base";
            var          baseSchema     = YamlSchemas.Single(s => s.Name == baseSchemaName);

            // Currently the tracing schema exists outside of the base schema, and needs to be "re-attached"
            var otherBaseSchemas = YamlSchemas.Where(s => string.IsNullOrWhiteSpace(s.Prefix) && s.Name != baseSchemaName).ToArray();

            foreach (var otherBaseSchema in otherBaseSchemas)
            {
                foreach (var(key, value) in otherBaseSchema.Fields)
                {
                    if (!baseSchema.Fields.ContainsKey(key))
                    {
                        baseSchema.Fields.Add(key, value);
                    }
                }
            }

            _baseSchema = baseSchema;
            return(_baseSchema);
        }
Example #2
0
        public YamlSchema BaseYamlSchema()
        {
            if (_baseRoot != null)
            {
                return(_baseRoot);
            }

            var otherRoots = YamlSchemas.Where(s => string.IsNullOrWhiteSpace(s.Prefix) && s.Name != "base").ToArray();
            var baseRoot   = YamlSchemas.Single(s => s.Name == "base");

            foreach (var otherRoot in otherRoots)
            {
                foreach (var otherRootField in otherRoot.Fields)
                {
                    if (!baseRoot.Fields.ContainsKey(otherRootField.Key))
                    {
                        baseRoot.Fields.Add(otherRootField.Key, otherRootField.Value);
                    }
                }
            }
            _baseRoot = baseRoot;
            return(_baseRoot);
        }
Example #3
0
 public static string DescriptionSanitized(this YamlSchema value) =>
 value.Description.Sanitized();
Example #4
0
 public static string NamePCased(this YamlSchema value) =>
 FileGenerator.PascalCase(value.Name);
Example #5
0
 public NestedFields(YamlSchema schema) => _schema = schema;