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