Exemplo n.º 1
0
        private static async Task <int> ReportSchemaDiagnostics(BebopSchema schema)
        {
            var noWarn       = _flags?.NoWarn ?? new List <string>();
            var loudWarnings = schema.Warnings.Where(x => !noWarn.Contains(x.ErrorCode.ToString()));
            var errors       = loudWarnings.Concat(schema.Errors).ToList();
            await Log.WriteSpanErrors(errors);

            return(schema.Errors.Count > 0 ? Err : Ok);
        }
Exemplo n.º 2
0
        private static async Task <int> CheckSchema(string textualSchema)
        {
            try
            {
                var parser = new SchemaParser(textualSchema, "CheckNameSpace");
                var schema = await parser.Parse();

                schema.Validate();
                if (schema.Errors.Count > 0)
                {
                    await Log.WriteSpanErrors(schema.Errors);

                    return(Err);
                }
                return(Ok);
            }
            catch (Exception e)
            {
                await ReportError(e);

                return(Err);
            }
        }