Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Document the atomic component move (POST {component}/move)

已关闭 适合新手
#264 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
文档
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
documentation

调研方向

阅读content/4.api/下现有的组件位置和页面数据文档,然后在这些端点旁边记录POST {component IRI}/move。涵盖请求变体、原子移动行为、响应、验证和授权错误,以及 issue 中描述的草稿处理。完成标准是端点和示例说明如何移动或重新排序组件,以及如何重新读取最终状态。

由索引模型根据 Issue 内容生成。

描述

The API bundle now has an atomic component move (components-web-app/api-components-bundle#526, PR components-web-app/api-components-bundle#533), which the Nuxt module will use (cwa-nuxt-module #415). Please document it in content/4.api/ (component positions / page data):

Endpoint: POST {component IRI}/move (e.g. /component/html_contents/{id}/move, under the route import prefix), application/ld+json, available on every component resource like {component IRI}/usage.

Body:

{ "from": { "componentPosition": "<iri>" } | { "pageData": "<iri>", "property": "<name>" },
  "to":   { "componentGroup": "<iri>", "after": "<position iri>"?, "before": "<position iri>"? } | { "pageData": "<iri>", "property": "<name>" } }

What happens (one request, one database flush, so a component is never left in two places or deleted by a dropped connection):

  • position → group: the same position is moved (its IRI is kept) and placed by after/before, or at the end, exactly as PATCH <position> {componentGroup, after|before}; within the same group it is a reorder.
  • position → page data property: the property is set and the position removed; the component is not deleted even if that was its only use.
  • page data property → group: a new static position is created and placed; the property is nulled.
  • property → property: one is set and the other nulled, across two page data resources too. Dynamic (pageDataProperty) positions are never changed.

Response: 200 with componentPosition (the moved or created position's IRI, null for a property target) and from/to echoed. Re-read the groups' /order and the page data for the new state.

Errors: 422 with violations at from, to, from.componentPosition, from.pageData, from.property, to.componentGroup, to.after, to.before, to.pageData, to.property: the same checks as the separate writes (allowedComponents, maxComponents, explicitAllowOnly, a component placed inside itself, anchors in the target group, the property's component class), plus the target being the source property, a dynamic or empty source position, an empty source property, a from that does not hold the component (a draft and its published component count as one), and a target property that already holds a component (refused rather than replaced). 403 when the caller is not granted one of the underlying writes (the position write and each page data PATCH, e.g. routable_security on unreachable page data); 401 for anonymous callers.

Drafts: moving by a draft's IRI moves the published component, and the published component is what is stored.

主要语言
TypeScript
星标
0
派生
0
平均合并
1 小时 20 分钟
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

components-web-app/docs 的其他 Issue

查看 components-web-app/docs 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。