Esempio n. 1
0
 public void Read(YamlNode rootNode)
 {
     this.root = rootNode;
     if (rootNode.GetRequiredString("swagger") != "2.0")
     {
         throw new YamlError(rootNode, "swagger isn't 2.0");
     }
     ReadPaths(rootNode.FirstChildNamed("paths"));
 }
Esempio n. 2
0
        private void ReadParametersObject(YamlNode par)
        {
            var name = "<unknown>";
            try
            {
                name = par.GetRequiredString("name");
                this.MatchName(par, name);

                var din = par.GetRequiredString("in");
                IsOneOf(din, "query", "header", "path", "formData", "body");
                if (din == "body")
                {
                    this.ReadSchemaObject(par.FirstChildNamed("schema"));
                }
                else
                {
                    par.GetRequiredString("type"); // required
                    this.ReadSchemaObject(par);

                    var form = par.GetStringOrNull("format");
                    if (form != null)
                    {
                        this.IsOneOf(form, "int32", "int64", "float", "double", "byte", "date", "date-time", "password");
                    }
                }

                this.ReadSchemaObject(par);
            }
            catch (Exception xx)
            {
                throw new YamlError(xx, par, "...while reading parameter " + name);
            }
        }
Esempio n. 3
0
 private void ReadResponseObject(YamlNode value)
 {
     value.GetRequiredString("description");
     var schema = value.FirstChildNamedOrNull("schema");
     if (schema != null) ReadSchemaObject(schema);
 }