Repository navigation
Initial CRUD with proposed metadata handling - #37
Conversation
f0ea3b6 to
9d01d26
Compare
302ebb0 to
52b1158
Compare
|
I'm curious about the removal of slash semantics. For some years, ending a resource identifier with a slash in its creation has been the way to indicate that the user wants it to be a container. How does a user indicate this desire without the slash semantics? |
@TallTed I think the solid spec uses the link header to determine if a new resource should be a container with no reference to the slash semantics. For TrinPod, we only look for http://www.w3.org/ns/ldp#BasicContainer; and http://www.w3.org/ns/ldp#Container; in the link header to set as a container or not. |
I think I remember this slash pattern from LDP spec development, where one of the goals was to enable full functionality with simple tools like I think something along the lines of the sentences above should be added to the LWS spec, i.e., replace the previously available "Just put a slash at the end!" pattern with a "just include this header with this value. For example, use this flag and this argument with |
d772ac0 to
a8b6d19
Compare
| @@ -0,0 +1,135 @@ | |||
| ### Create Resource (HTTP POST) | |||
|
|
|||
| New resources are created using POST to a target container URI, with the server assigning the final identifier. Clients MAY suggest a name via the Slug header, but servers MUST have authority over naming to ensure uniqueness and compliance with policies. PUT is reserved for updates to existing resources and MUST NOT be used for creation in this version of the specification, to prioritize server-managed identifiers and simplify client-server interactions. Clients MAY provide initial user-managed metadata for the new resource by including one or more Link headers in the POST request, following the syntax of [RFC 8288]. Server-managed metadata MUST be generated automatically by the server upon creation and MUST NOT be overridden by client-provided links. | |||
There was a problem hiding this comment.
Is there a plan to support create with PUT/PATCH, using conditional requests.
Since Slug header can't be relied on, there doesn't seem to be a way for the client to create at specific location. This makes it harder to build offline-first application since resources can't be fully interlinked locally before syncing them with the web storage.
There was a problem hiding this comment.
This probably isn't the best place to discuss it. I will find existing use case or add a new one for creating linked resources offline and bring it up later. The can be other ways to address it.
acoburn
left a comment
There was a problem hiding this comment.
I haven't finished my review, but this covers much of the text.
| **Possible Responses:** *(on the abstract operation level, not tied to a specific protocol)* | ||
| * **Created:** The operation succeeded in creating a new resource. The response includes the new resource’s identifier and possibly a minimal representation or metadata. | ||
| * **Bad Request:** The request was malformed or violated constraints. The resource was not created. | ||
| * **Not Permitted:** The client is not authorized to create a resource in the target location. | ||
| * **Not Found:** The specified target container does not exist or cannot be found. This could also be treated as a type of Bad Request or Not Permitted, depending on the cause. | ||
| * **Unknown Error:** An internal server error occurred, or some unexpected condition prevented the creation. This is a catch-all for failures not covered by more specific errors. The response would indicate that the server failed the operation (and ideally include an error message or code). No newline at end of file |
There was a problem hiding this comment.
Is this an exhaustive list? Could there be other responses? I think it would be good to allow other possible responses.
| | ----- | ----- | ----- | | ||
| | [Success](https://w3c.github.io/lws-protocol/spec/#dfn-success) Success (read or update, returning data) | 200 OK | [Resource representation](https://w3c.github.io/lws-protocol/spec/#dfn-resource-representation) in the response body (for GET or if PUT/PATCH returns content), along with relevant headers (Content-Type, ETag, Link for metadata such as rel="linkset", rel="acl", rel="parent"). For container listings, include JSON-LD with normative context and member metadata (IDs, types, sizes, timestamps). | | ||
| | Partial Success (paginated or ranged read) | 206 Partial Content | Partial resource representation, with headers like Content-Range or Link rel="next" for pagination. Listings include filtered metadata per ACL visibility. | | ||
| | [Created](https://w3c.github.io/lws-protocol/spec/#dfn-created) (new resource) | 201 Created | Typically no response body (or a minimal representation of the new resource). The `Location` header is set to the new resource’s URI. Headers like ETag MUST be included for concurrency; Link headers for server-managed metadata. | |
There was a problem hiding this comment.
If the response body is empty and an ETag value is supplied, this will mess with caches. Generally speaking, ETags are not included in POST responses.
I would state that the Location header is required in the response.
| | [Unknown requester](https://w3c.github.io/lws-protocol/spec/#dfn-unknown-requester) | 401 Unauthorized | Typically no body or an error message. The response MUST include a `WWW-Authenticate` header with parameters for discoverability and authentication negotiation (per HTTP spec). This indicates the client needs to provide credentials. | | ||
| | [Not Permitted](https://w3c.github.io/lws-protocol/spec/#dfn-not-permitted) (forbidden) | 403 Forbidden | An error message or none. Indicates the client’s credentials were accepted but they don’t have rights to perform the operation. | | ||
| | Not found | 404 Not Found | Possibly an error message. Indicates the resource (or target URI) does not exist *or* is not accessible. (Servers MUST use 404 in place of 403 for unauthorized reads to avoid revealing the existence of a resource, aligning with privacy considerations.) | | ||
| | Not acceptable | 406 Not Acceptable | Typically a short message listing supported formats or indicating that the requested representation cannot be provided. The client may use this information to retry with a different `Accept`. | | ||
| | Conflict | 409 Conflict | Explanation of the conflict. The body could include specifics or be empty with just the status reason. | | ||
| | Precondition Failed (concurrency) | 412 Precondition Failed | If an `If-Match` or similar header doesn’t match, this status is returned with maybe a brief message. | | ||
| | Unsupported Media Type | 415 Unsupported Media Type | If the client sent a format that the server cannot handle (for create or update). The body might list acceptable media types. | | ||
| | Insufficient Storage (quota exceeded) | 507 Insufficient Storage | Error details indicating quota or storage constraints violated. Could include current usage information in the body. | | ||
| | Internal Server Error [Unknown error](https://w3c.github.io/lws-protocol/spec/#dfn-unknown-error) | 500 Internal Server Error | A generic error message. In a debug or dev mode, the server might include a stack trace or internal details in the body, but in production it should be a generic statement. | |
There was a problem hiding this comment.
These are all standard HTTP error codes (and there are other possible response codes). I would avoid restating what already exists in the HTTP spec.
|
|
||
| This mapping table is intended to cover the typical cases, ensuring atomicity with metadata operations and support for discoverability. Note that some status codes above (206, 412, 415, 507) are standard HTTP but were not explicitly enumerated in Section 7’s generic list; they are used here to handle HTTP-specific scenarios (like pagination, conditional requests, media type handling, and quotas). LWS servers should use the most appropriate HTTP status code for each situation to enable clients to react correctly. | ||
|
|
||
| By adhering to these method bindings and status codes, LWS clients and servers can interoperate using HTTP in a predictable, RESTful way. This allows leveraging existing HTTP libraries, tools, and knowledge for building LWS-based systems. No newline at end of file |
There was a problem hiding this comment.
This seems more for a non-normative introduction section rather than a normative section.
| | Insufficient Storage (quota exceeded) | 507 Insufficient Storage | Error details indicating quota or storage constraints violated. Could include current usage information in the body. | | ||
| | Internal Server Error [Unknown error](https://w3c.github.io/lws-protocol/spec/#dfn-unknown-error) | 500 Internal Server Error | A generic error message. In a debug or dev mode, the server might include a stack trace or internal details in the body, but in production it should be a generic statement. | | ||
|
|
||
| This mapping table is intended to cover the typical cases, ensuring atomicity with metadata operations and support for discoverability. Note that some status codes above (206, 412, 415, 507) are standard HTTP but were not explicitly enumerated in Section 7’s generic list; they are used here to handle HTTP-specific scenarios (like pagination, conditional requests, media type handling, and quotas). LWS servers should use the most appropriate HTTP status code for each situation to enable clients to react correctly. |
There was a problem hiding this comment.
Does this paragraph state anything that isn't already part of the HTTP RFC?
|
Too many commits & comments in a single PR. GitHub now says to me, "Some comments aren't visible on the classic Files Changed page. Switch to the new experience." and then "Only the first 40 comments are currently being shown. To see more, switch back to the classic page." I cannot tell what comments are visible on each, nor what comments are visible on neither — so cannot review the entire PR in either view. |
|
For Creating resources, why is it not possible to create a resource in the Storage itself outside of a container? "Target container identifier: The identifier of an existing container where the new resource will be created as a member." "8.4 Containment and Hierarchy How does this work with linked data in general where the subject uri for a resource is not on a path uri in an LWS storage system? Having resources where linked data subject uri's are able to be in the LWS itself (and potentially in many different LWS's) and not in a particular container solves this problem created by emulating an old directory tree structure for files. For cases where container structures are used, having more than a single membership predicate enables support for non file hierarchies. Currently, TwinPod supports the following membership predicates: |
|
From discussion in editors call - the diff of this as compared to the Solid specification is as followed:
|
elf-pavlik
left a comment
There was a problem hiding this comment.
I see this PR as a great baseline to iterate further with smaller PRs addressing very specific issues.
4e215fb to
f609363
Compare
…on, REST Binding trim and make text more concise formatting add concurrency control PA modifications ~ reorg for multiple specs remove non-normative text Update lws10-core/Operations/create-resource.md clarify response and make it less prescriptive. move text (if needed) to authorization section more spacing spacing spacing spacing make PATCH a MUST for metadata update and PUT optional make text more concise remove response codes already part of http spec fix links remove range requests line to make it more concise clarify returned metadata. remove filter text for later PR remove server sending an HTML page. security considerations. remove content negotiation text remove text remove security considerations text consolidate text for abstract delete and separate examples in HTTP Delete section the storage description link uses a Link header, not a WWW-Authenticate parameter simplify text use application/lws+json for container creation. Remove linksetfilter work for later PR make text more concise. remove "Servers MUST support concurrency ...". Change out text with alternate wording. remove uncalled response removed dc elements in favor or dc terms. Removed placeholder metadata. clairify text remove mandatory/optional text remove defined for acl, linkset, type, mediaType (now representation) clairify potenitally ambiguous text remove advanced property/relation filtering for now revise text to use https://www.w3.org/ns/lws#PreferLinkRelations omit/include trim text remove text remove 403 vs 404 text remove text remove restrictive text remove auth text redundant to authorization section update links remove HTTP examples (add to HTTP binding section if not already there) remove security consideration text Update lws10-core/Operations/read-resource.md remove text to be potentially relocated to security considerations section remove unnecessary text clarify concurrency control text clarify that the list is not exhaustive remove unineeded wording. remove ambigious phrasing. Update lws10-core/Operations/read-resource.md Update lws10-core/Operations/delete-resource.md Update lws10-core/Rest-Binding/rest-create-resource.md Update lws10-core/Rest-Binding/rest-create-resource.md Update lws10-core/Rest-Binding/rest-create-resource.md Update lws10-core/Rest-Binding/rest-delete-resource.md Update lws10-core/Rest-Binding/metadata.md Update lws10-core/Rest-Binding/metadata.md Update lws10-core/Rest-Binding/metadata.md Update lws10-core/Rest-Binding/metadata.md Update lws10-core/Operations/update-resource.md Update lws10-core/Operations/update-resource.md Update lws10-core/Operations/update-resource.md Update lws10-core/Operations/update-resource.md Update lws10-core/Operations/read-resource.md Update lws10-core/Rest-Binding/rest-delete-resource.md Update lws10-core/Rest-Binding/metadata.md Update lws10-core/Operations/delete-resource.md Update lws10-core/Operations/delete-resource.md Update lws10-core/Operations/delete-resource.md Update lws10-core/Operations/delete-resource.md Update lws10-core/Operations/create-resource.md corrected lws namespaces make modifications to reflect terminology (partOf, contains, etc) Apply suggestions from code review Adjust datatype Oct 2025 Meeting outcomes standardize one json patching method, remove binary patch Align draft spec based on discussion from Belgium Face-to-face to present day remove slash semantics normalize attr with attributes (instead of fields) remove slash semantics format formatting clarify formatting fix links define three types of metedata add metadata via web linking reorganize sections to folders formatting Update spec/create-resource.md Update spec/delete-resource.md formatting formatting formatting link for brevity Update spec/create-resource.md Update spec/create-resource.md Update spec/rest-read-resource.md Apply suggestions from code review formatting Co-Authored-By: Aaron Coburn <[email protected]> Co-Authored-By: Ted Thibodeau Jr <[email protected]> Co-Authored-By: Jesse Wright <[email protected]>
|
As per LWS meeting 1/5/2026, #37 has been rebased to 1 commit |
|
2 commits with +544 & −101 lines, across 21 files. Should be much more reviewable, thank you! |
acoburn
left a comment
There was a problem hiding this comment.
This is a good step forward. There are some improvements that can come later (I do not think they need to hold up this PR). Some improvements are:
- It is unclear to me what is normative text and what is non-normative text. This may be due to my greater familiarity with the HTML format used by respec as opposed to the markdown format.
- The text seems verbose or redundant in places. I suspect that there are ways to simplify the various sections to avoid redundancy
- I am not convinced about certain requirements (e.g. ETags). Yes, their use is a very good idea, but should this actually be required? I don't think so
Still, I think this is in good enough shape to merge and move forward. This will allow us to have more targeted refinements as follow-up PRs.
| | http://purl.org/dc/terms/creator | [dcterms](http://purl.org/dc/terms/) | | ||
|
|
||
| **Modifiability Considerations** | ||
| Core metadata, such as 'partOf', 'contains', 'type', 'title', and 'creator', MAY be modified by clients via PATCH operations on the associated linkset resource; servers MUST support JSON Merge Patch for partial updates. Servers MAY also support PUT for complete metadata replacement, but clients SHOULD NOT assume its availability and MUST handle rejections accordingly. However, servers MAY impose restrictions on certain core links to maintain system integrity. For instance, modifying the 'partOf' or 'contains' link to 'move' a resource is OPTIONAL for server implementations, as it may involve complex operations like updating slash-based semantics or decoupling containment meanings. Clients SHOULD NOT assume universal support for such changes and MUST handle server rejections. Servers that do not support modifications to 'partOf' MUST document this in their conformance statements. Metadata lifecycles are tied to the described resource, with automatic deletion upon resource removal. |
There was a problem hiding this comment.
Would it be easier to state that servers MUST advertise GET and PATCH support via the Allow header. Furthermore, we can require that JSON Merge Patch support be advertised via the Accept-Patch header, i.e., Accept-Patch: application/merge-patch+json. Any other features a server provides (alternative methods or serialization support) would just use those same mechanisms.
| Because a resource's metadata can be modified by multiple actors, preventing concurrent overwrites is critical. To ensure data integrity, LWS servers and clients MUST implement optimistic concurrency control using conditional requests [[RFC 7232](https://datatracker.ietf.org/doc/html/rfc7232)] for all PUT and PATCH operations on a linkset resource. | ||
| Server Responsibilities: | ||
| A server **MUST** include an Etag header in its responses to GET and HEAD requests for a linkset resource. | ||
| Upon a successful PUT or PATCH on the linkset, the server MUST generate a new, unique Etag value for the modified linkset and return it in the Etag header of the response. | ||
| Client Responsibilities: | ||
| When modifying a linkset resource, a client MUST include an If-Match header containing the most recent Etag it received for that resource. | ||
| Processing Rules: | ||
| If the If-Match header value does not match the linkset's current Etag, the server MUST reject the request with a 412 Precondition Failed status code. | ||
| If the If-Match header is missing from a PUT or PATCH request to a linkset URI, the server MUST reject the request with a 428 Precondition Required status code [[RFC 6585](https://datatracker.ietf.org/doc/html/rfc6585#section-3)]. |
There was a problem hiding this comment.
Requiring ETags seems excessive. Instead, I would suggest that clients SHOULD use concurrency headers to avoid lost updates.
There was a problem hiding this comment.
Definitely agree with requiring ETags - they are the foundation for all caching, including in the browser caches.
| @@ -0,0 +1,5 @@ | |||
| This section defines how the generic operations and responses from Section 7 are realized over HTTP using RESTful conventions. It specifies the HTTP methods, request formats, and status codes that an [LWS REST Servers](https://w3c.github.io/lws-protocol/spec/#dfn-lws-rest-server) and [LWS REST Clients](https://w3c.github.io/lws-protocol/spec/#dfn-lws-rest-client) should use for interoperability. In other words, it’s a concrete mapping of the abstract operations to HTTP requests and responses. The following assumes an LWS server exposing resources via HTTP URIs, and an LWS client using HTTP methods (GET, POST, PUT, PATCH, DELETE, etc.) to invoke the operations. | |||
There was a problem hiding this comment.
Using relative links would be better here. These links will break once it is moved to a different domain
| @@ -0,0 +1,5 @@ | |||
| This section defines how the generic operations and responses from Section 7 are realized over HTTP using RESTful conventions. It specifies the HTTP methods, request formats, and status codes that an [LWS REST Servers](https://w3c.github.io/lws-protocol/spec/#dfn-lws-rest-server) and [LWS REST Clients](https://w3c.github.io/lws-protocol/spec/#dfn-lws-rest-client) should use for interoperability. In other words, it’s a concrete mapping of the abstract operations to HTTP requests and responses. The following assumes an LWS server exposing resources via HTTP URIs, and an LWS client using HTTP methods (GET, POST, PUT, PATCH, DELETE, etc.) to invoke the operations. | |||
|
|
|||
| For each core operation (create, read, update, delete), we describe the HTTP method(s) to use, required headers or special considerations (including concurrency controls via ETags, content negotiation, and pagination for container listings), and what the server should do and return. Standard HTTP status codes are used to indicate outcomes (success or various errors), following the semantics outlined in Section 7, with additional mappings for scenarios such as quota exceeded (507 Insufficient Storage) or precondition failures (412 Precondition Failed). The binding tries to adhere to HTTP/1.1 and relevant RFCs (such as [[RFC 7231](https://datatracker.ietf.org/doc/html/rfc7231)] for HTTP semantics, [[RFC 7233](https://datatracker.ietf.org/doc/html/rfc7233)] for range requests, [[RFC 5789](https://www.rfc-editor.org/rfc/rfc5789.html)] for PATCH, [[RFC 8288](https://www.rfc-editor.org/rfc/rfc8288.html)] for Web Linking, and [[RFC 9264](https://www.rfc-editor.org/rfc/rfc9264.html)] for Link Sets) so that it integrates naturally with web standards. Discoverability is emphasized through mechanisms like Link headers and WWW-Authenticate headers on 401 responses, avoiding hardcoded URI locations. Metadata integration, as defined in Section 9.1, is required across operations, ensuring atomicity and use of Link Sets for server-managed and user-managed properties. | |||
There was a problem hiding this comment.
Generally, RFC references should use [[spec-ref]]. For normative references, use [[!spec-ref]]
| @@ -0,0 +1,2 @@ | |||
| this left intentionally blank | |||
There was a problem hiding this comment.
This file is no longer relevant and should be removed
|
Ability to use subject URI that is not "native" to URI path of LWS server. Use cases include: Scientists using the same standard protein uri as a subject resource in their LWS, Adding a resource where the subject URI is a location (geo) a topic (wikidata) a bookmark (any uri), having ontology in your LWS that you can count on that uses commonly understood URIs, such as schema: foaf: sio: etc., adding a resource about a friend's webid, a company/org webid etc. For this section: Propose revise above to: Propose revise above to: Propose add under Inputs:
Propose revise to:
(The same strategy for the other verbs, https://example.pod.com&subject=https%3A%2F%2Falice.com%2Fi ) |
Co-authored-by: Aaron Coburn <[email protected]>
Co-authored-by: Aaron Coburn <[email protected]>
Co-authored-by: Aaron Coburn <[email protected]>
Co-authored-by: Pierre-Antoine Champin <[email protected]>
Add optional --lws-mode flag to support W3C Linked Web Storage protocol semantics alongside current Solid/LDP implementation. Changes: - Add lwsMode config flag (CLI, env var, config file) - Implement PUT restriction in LWS mode (updates only, not creation) - Add request.lwsMode decoration in server - Add basic LWS tests demonstrating PUT/POST behavior - Document LWS mode in README with examples Key difference: In LWS mode, PUT returns 404 for non-existent resources and suggests using POST for creation (server-assigned URIs with Slug). Status: DRAFT - LWS spec is in early stages. This captures the basic infrastructure for future development. See issue #87 for full plan. Related: #87 Spec: w3c/lws-protocol#37
For Container resources, hierarchy up from that container should also be delivered so apps can navigate etc (Standard on TwinPod for all requests). For paging, the paging approach should not use the LDP paging as this is not cacheable, but a simple approach which servers can cache with, such as Apache with start=n&rows=m. If apps want to include defining page lengths etc, they can, and then use the simple paging query to the server for caching. |
Preview | Diff