Пример #1
0
 public EnumDescription(OpenApiObject source)
 {
     if (source.TryGetValue("value", out var rawValue) && rawValue is OpenApiString value)
     {
         Value = value.Value;
     }
     if (source.TryGetValue("description", out var rawDescription) && rawDescription is OpenApiString description)
     {
         Description = description.Value;
     }
     if (source.TryGetValue("name", out var rawName) && rawName is OpenApiString name)
     {
         Name = name.Value;
     }
 }
Пример #2
0
        public virtual void Parse(OpenApiObject data, IEndpointsParser parser)
        {
            Description = data.GetString("description");
            Uri         = data.GetString("uri");

            if (data.TryGetValue("children", out var anyData) && anyData is OpenApiObject objData)
            {
                Children.Parse(objData, parser);
            }
        }
Пример #3
0
 /// <summary>
 /// Gets a string property with specified <paramref name="name"/> from the <paramref name="obj"/>.
 /// </summary>
 /// <returns>The value of the property or <c>null</c> if it was not found or had the wrong type.</returns>
 public static string?GetString(this OpenApiObject obj, string name)
 => obj.TryGetValue(name, out var anyData) && anyData is OpenApiString stringData ? stringData.Value : null;