Open wierzba3 opened 5 years ago
I do this on my models but you have to introduce another layer e.g. /api/assets, /api/workflow etc rather than having an implicit default of /api.
To my mind this makes discovery easier and also implies the separation between the two parts of the API
We have a need to restrict a certain subset of our OData API surface for one route prefix. We wish to return 404 when an API is accessed that is not supported for that route. We need to know how we can (and how we should) accomplish this.
See the code below. This does not work. When we swap in the old model, we see errors that appear to indicate that OData expects ALL OData functionality to be mapped in the model. The error is
Where products are intentionally excluded from the model. We desire a 404 response for this api "/api/subset/products", but instead, the service crashes on startup due to the error above.
Is this not supported?
If not, what other options are there to accomplish this? Must we explicitly return 404 in the controller API function? (this would require analyzing the path for "api/subset" in the API function, which seems to me like a hack)