angular / in-memory-web-api

The code for this project has moved to the angular/angular repo. This repo is now archived.
MIT License
1.18k stars 232 forks source link

id should be optional #198

Open MickL opened 6 years ago

MickL commented 6 years ago

According to readme:

The in-memory web api library currently assumes that every collection has a primary key called id.

And:

If you do not specify the id, the service generates one via the genId method.

Which kind of contradict each other, don't they? Anyway there should be the option to have no id what so ever. For example the following response is not possible to generate:

interface AuthResponse {
    success: boolean;
    token: string;
}

I know the readme says you don't want to make every API possible. But why won't you? This module is great why not develop it further than for Tour of Heroes? Should we fork it and develop it independently?

CT99 commented 6 years ago

Requiring the primary key to be called 'id' is a HUGE problem. I'm mapping to / reading from a data file that uses 'id' to mean something completely different from what my primary key is / should be. To use this in-memory-web-api I'll have to translate YOUR primary key id to my primary key name -- this is not only inconvenient but extremely confusing. PLEASE fix this -- thanks.