public bool TryWriteValue(IOpenApiWriter writer, JSchema schema) { var example = schema.GetExample(); if (example == null) { return(false); } writer.WriteJToken(example); return(true); }
public bool TryWriteValue(IOpenApiWriter writer, JSchema schema) { var isEnum = schema.Enum != null && schema.Enum.Count > 0; if (!isEnum) { return(false); } var valueIndex = Random.Next(0, schema.Enum.Count); var value = schema.Enum[valueIndex]; writer.WriteJToken(value); return(true); }