Comments (1)
Thanks for the issue.
Unfortunately this kind of path/naming is not supported.
curl -X GET "http://localhost:57603/api/garage/v3.0/storage/bins" -H "accept: application/json"
Now API tries to look for items, with these parameters:
collection=garage
id=v3.0
path=storage/bins
Supporting slashes in collection names could be possible, but would require lots of changes as current implementation relies on dividing the request by slashes.
{
"garage/v3.0/storage/bins": [
{
"type": "Large",
"id": 0
},
{
"type": "Small",
"id": 1
}
],
"garage/v3.0/storage/shelves": [
{
"type": "Large",
"id": 0
},
{
"type": "Small",
"id": 1
}
],
}
As you mentioned you can get this almost working by using nested items.
Change ApiRoute from Config file:
public class Config
{
public const string ApiRoute = "garage/v3.0";
public const string AsyncRoute = "async";
public const string GraphQLRoute = "graphql";
public const string TokenRoute = "token";
public const string TokenLogoutRoute = "logout";
}
Json file should be like this:
{
"storage": [
{
"id": "bins",
"bins": [
{
"type": "Large",
"id": "0"
},
{
"type": "Small",
"id": "1"
}
]
},
{
"id": "shelves",
"shelves": [
{
"type": "High",
"id": "0"
},
{
"type": "Low",
"id": "1"
}
]
}
]
}
Query has unfortunately double bins as now bins is an id and the name of the collection property.
curl -X GET "http://localhost:57603/api/garage/v3.0/storage/bins/bins/0" -H "accept: application/json"
Correct implementation would be that single items would support searching for nested properties. Now only collections support that.
Then we could query inside an item. Now only whole item can be returned.
curl -X GET "http://localhost:57603/api/garage/v3.0/storage/" -H "accept: application/json"
{
"storage": {
"bins": [
{
"type": "Large",
"id": 0
},
{
"type": "Small",
"id": 1
}
],
"shelves": [
{
"type": "High",
"id": 0
},
{
"type": "Low",
"id": 1
}
]
},
"workbench": {
"tools": [
{
"type": "Hammer",
"id": 0
},
{
"type": "Saw",
"id": 1
}
]
}
}
Have to think what would be the best way to implement this.
from dotnet-fake-json-server.
Related Issues (20)
- Upgrade McMaster.Extensions.CommandLineUtils to version 4.x
- Fix Vue from index.html
- Option to create a new Object HOT 4
- Add custom response HOT 5
- Merge patch should support nested properties
- Add support for Accept header and CSV type
- Add support for XML output content type
- Fix XML element naming for collections and single items
- Bad XML tags occuring when getting single family HOT 1
- Update to .NET Core 3.1 HOT 6
- DELETE operations put server in Bad State HOT 1
- Support numeric string for collection identifiers HOT 5
- Broken Auth in Swagger UI HOT 4
- Add Swagger URL to startup output HOT 3
- Release unreleased features HOT 1
- If a key with an empty array value exists in the data source, the api /collectionId endpoint returns the NotFound state. HOT 1
- Integration with external oAuth2 server such as IdentityServer4 or Azure AD HOT 1
- Travis CI test (Linux) fail with "System.IO.IOException: The configured user limit (128) on the number of inotify instances has been reached ..."
- [Feature] On Republish keep previous data HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotnet-fake-json-server.