Forum Discussion

bec1442's avatar
bec1442
Visitor
7 months ago

Swagger not returning everything

Created my first API (learning)

Two classes, first class looks lie this

public class Imaging

 {

    public int ImagingId { get; set; }

    public string? TxSite { get; set; }

    public string? ImagingType { get; set; }

    public string? alignTo { get; set; }

    public bool Active { get; set; }

    public string? CreatedDate { get; set; }

    public string? CreatedBy { get; set; }

    public string? ModifiedDate { get; set; }

     public string? ModifiedBy { get; set; }

 }

 

The second includes a list for the first class

public class Issue

 {

     public int Id { get; set; }

     [Required]

     public string Title { get; set; }

     [Required]

     public string Description { get; set; }

     public Priority Priority { get; set; }

     public IssueType IssueType { get; set; }

     public DateTime Created { get; set; }

     public DateTime? Completed { get; set; }

     //list of imagining

     public List<Imaging>? Imaging { get; set; }

 }

 

When open the end-point, the sample schema looks good schema (nested objects)

but when I execute , the list is null 

my controller is rather simple 

[HttpGet]
public async Task<IEnumerable<Issue>> Get() => await _context.Issues.ToListAsync();

How do I get the values from the Image object?

many thanks in advance

No RepliesBe the first to reply