Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 public static string DescriptionSanitized(this YamlSchema value) =>
 value.Description.Sanitized();
Ejemplo n.º 4
0
 public static string NamePCased(this YamlSchema value) =>
 FileGenerator.PascalCase(value.Name);
Ejemplo n.º 5
0
 public NestedFields(YamlSchema schema) => _schema = schema;