feat: add NGSI-LD scope/scopeQ support#110
Conversation
Add --scope-q option to entities list for hierarchical scope filtering, display scope property in table output, and update geonicdb to v0.2.1.
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 9 minutes and 13 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
Changes
Sequence DiagramsequenceDiagram
participant User as "ユーザー"
participant CLI as "geonic CLI"
participant Client as "HTTP クライアント"
participant Backend as "Backend API"
participant Formatter as "出力フォーマッタ"
User->>CLI: geonic entities list --scope-q "/restaurants/#"
CLI->>Client: GET /entities?scopeQ=/restaurants/%23
Client->>Backend: HTTP GET (scopeQ)
Backend-->>Client: 200 OK (entities[] with scope)
Client-->>CLI: results
CLI->>Formatter: format table (place scope after id/type)
Formatter-->>User: 表形式出力 (scope: "/A, /B")
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@CHANGELOG.md`:
- Around line 11-13: Update the CHANGELOG.md entries for the three bullets about
entities list/table/create so their suffixes include the PR number `#110` (either
replace or append to the current `#109`), i.e., adjust the three lines
mentioning `entities list`, table `scope` display, and `entities create` help
examples to include `#110` per PR-number convention.
In `@src/output.ts`:
- Around line 135-138: The cellValue function currently maps every array element
with String which turns object elements into "[object Object]"; update cellValue
(the Array.isArray branch) to detect if all elements are scalars
(string|number|boolean|null|undefined) and only then return elements.join(", "),
otherwise fallback to JSON.stringify the whole array (or each element) so object
arrays are preserved (e.g., keep the scalar-friendly join for scope-like arrays
and JSON for object-containing arrays).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6bf0d642-7c76-49c5-8604-0b6c78d72b34
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (6)
CHANGELOG.mdsrc/commands/entities.tssrc/output.tstests/e2e/features/entities.featuretests/entities.test.tstests/output.test.ts
User creation endpoint now expects primaryTenantId instead of tenantId.
Pin geonicdb dependency to specific commit (326b12a) to prevent unexpected breakage from upstream changes. Add scheduled CI workflow that tests against latest geonicdb weekly and creates an issue on failure.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/geonicdb-compat.yml:
- Around line 3-10: The workflow must explicitly grant the GITHUB_TOKEN the
rights to create issues; add a permissions block that includes issues: write (so
gh issue create can succeed) — place this at the workflow or job level in the
YAML (e.g., add a top-level permissions: { issues: write } or under jobs.check)
to ensure the GITHUB_TOKEN used by gh issue create has write access when the
check job runs.
- Around line 63-70: The issue is the heredoc opener <<'EOF' disables shell
variable expansion so ${GEONICDB_VERSION}, ${GITHUB_SERVER_URL},
${GITHUB_REPOSITORY}, and ${GITHUB_RUN_ID} are left literal; fix by changing the
heredoc delimiter from <<'EOF' to an unquoted <<EOF (i.e., remove the single
quotes around EOF) so the variables inside the body are expanded when cat runs,
verifying the body string still remains wrapped in the outer --body "$(cat <<EOF
... EOF)" construct.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8f5ab7d1-7cab-4e91-8e50-b2023a9337db
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
.github/workflows/geonicdb-compat.ymlpackage.json
✅ Files skipped from review due to trivial changes (1)
- package.json
Summary
entities listに--scope-qオプションを追加 — NGSI-LDscopeQパラメータでスコープベースのフィルタリングに対応(全子孫/#、完全一致、1階層/+)scopeプロパティをid,typeの直後に表示、配列をカンマ区切りでフォーマットentities createのヘルプ description / examples にscopeプロパティの使用例を追加geonicdbを v0.2.1 に更新(#966 scope/servicePath 統一を含む)Closes #109
Test plan
--scope-qオプションがscopeQクエリパラメータとして送信されることを確認(ユニットテスト)scopeカラムがid,typeの直後に表示されることを確認(ユニットテスト)Summary by CodeRabbit
新機能
entities listに--scope-qオプションを追加し、NGSI-LD の scopeQ によるスコープフィルタ(子孫・完全一致・一段階一致)をサポート。scope列を追加し、id と type の直後に表示。配列値は適切にフォーマットして表示。entities createヘルプに scope の使用例を追加。ドキュメント
テスト