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; } }
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); } }
/// <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;