Creating a document with the name my/document leads to the following exception:
org.nuxeo.ecm.core.api.ClientException: Failed to create document: document
...
Caused by: org.nuxeo.ecm.core.model.NoSuchDocumentException: No such document: No such document: /default-domain/workspaces/ws/my
at org.nuxeo.ecm.core.storage.sql.coremodel.SQLSession.resolvePath(SQLSession.java:268)
at org.nuxeo.ecm.core.api.DocumentResolver.resolveReference(DocumentResolver.java:63)
at org.nuxeo.ecm.core.api.AbstractSession.resolveReference(AbstractSession.java:509)
at org.nuxeo.ecm.core.api.AbstractSession.fillCreateOptions(AbstractSession.java:953)
at org.nuxeo.ecm.core.api.AbstractSession.createDocument(AbstractSession.java:884)
... 112 more
name is required when creating a document: we need to use the PathSegmentService on it to be consistent with what's done when creating a document through the UI / drag'n'drop / ...
Current implementation of the PathSegmentService only generate a path segment from a document using its title. In the case of the REST API, we do not always have a title.
=> add a new method generating a path segment from a given string.