Forum Discussion

delucaezequiel's avatar
delucaezequiel
New Contributor
5 years ago

How to get examples of a Child Object

Hi:

 

I have an objects in my schema that have several child objects inside it. I would like to find a way to show the examples that appears on the child object as well. Example below (Request = Parent Object; User = Child Object)

public abstract class Request
{
  /// <summary>Unique identifier</summary>
  /// <example>00000000-0000-0000-0000-000000000000</example>
  [Key]
  [MinLength(36)]
  [MaxLength(36)]
  public Guid Id { get; set; }
  /// <summary>The one who raised the request.</summary>
  [Required]
  public User Requester;
}
public class User
{
  /// <summary>Unique identifier</summary>
  /// <example>00000000-0000-0000-0000-000000000000</example>
  [Key]
  [MinLength(36)]
  [MaxLength(36)]
  public Guid Id { get; set; }
  /// <summary>Active Directory Display Name.</summary>
  /// <example>xxxxx</example>
  public String DisplayName { get; set; }
  /// <summary>Active Directory User Principal Name.</summary>
  /// <example>xxxxx@domain.root</example>
  public String UserPrincipalName { get; set; }
}

If I do not set an example in the parent object, the property/attribute is not displayed on the example value section, and with xml comments I can only set a plain text comment, not the whole structure as desired. Do you know if this can be accomplished?

I am using OpenApi 3.0 and C# in my project

 

No RepliesBe the first to reply