Tom
Tom

Reputation: 16246

ServiceStack IReturn and metadata

It is interesting to see the meta displays differently with and without the IReturn implemented. When IReturn is implemented, I wonder how I can structure the DTOs to trim the metadata output?

enter image description here

Code

namespace Backbone.Todos {
//Without IReturn --------------------------
[Route("/todos","POST")] //add
[Route("/todos/{id}","POST")] //edit
public class Todo {
    public long Id { get; set; }
    public string Content { get; set; }
    public int Order { get; set; }
    public bool Done { get; set; }
}
//-----------------------------------------
[Route("/todos","GET")] //list
public class TodoList {
} 
//-----------------------------------------
[Route("/todos/{id}","DELETE")]//delete
public class DeleteTodo {
    public int Id { get; set; }
}
//-----------------------------------------
[Route("/todos/reset")] //reset
public class ResetTodos {
}

......

Now samething, but with IReturn<>, the metadata looks strange. Notice the List`1 and double Todos in the picture.

namespace Backbone.Todos {
//Implementing IReturn---------------------
[Route("/todos","POST")] //add
[Route("/todos/{id}","POST")] //edit
public class Todo : IReturn<Todo> {
    public long Id { get; set; }
    public string Content { get; set; }
    public int Order { get; set; }
    public bool Done { get; set; }
}
//-----------------------------------------
[Route("/todos","GET")] //list
public class TodoList : IReturn<List<Todo>>  {
} 
//-----------------------------------------
[Route("/todos/{id}","DELETE")]//delete
public class DeleteTodo : IReturnVoid {
    public int Id { get; set; }
}
//-----------------------------------------
[Route("/todos/reset")] //reset
public class ResetTodos : IReturnVoid{
}
//-----------------------------------------
......

Upvotes: 2

Views: 660

Answers (1)

mythz
mythz

Reputation: 143319

The metadata pages working with the New API is already fixed in the HEAD version of ServiceStack. You can fork the repo now, otherwise new releases of ServiceStack get deployed on the weekend.

Upvotes: 3

Related Questions