Are item IDs intended to be unique across all collections?
Closed this issue · 2 comments
Describe the bug
Currently item ID's are required to be unique across all collections. (Not sure if bug or not)
To Reproduce
Steps to reproduce the behavior:
- Run instance
docker-compose up
- Create collection with id
collection1
- Create collection with id
collection2
- Create item with id
item1
in collectioncollection1
- Create item with id
item1
in collectioncollection2
- See error:
{
"code": "ConflictError",
"description": "Item item1 in collection collection1 already exists"
}
Expected behavior
Unsure.
I think this should not happen, item IDs should only be unique within the collection.
Not sure how you got this error, it seems like it is covered in the database logic:
Or does the Item contain the collection ID? It might be possible to POST an Item where the collection in the HTTP request does not match the collection specified in the Item body.
Or does the Item contain the collection ID
You are right, my mistake...
Although this doesn't seem very logical, the collection id shouldn't be passed in the item body at all in my opinion since we already specify the collection id in the request URL:
POST http://localhost:8080/collections/{collection_id}/items