-
Notifications
You must be signed in to change notification settings - Fork 0
Partition canonical api spec output #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Test Results16 tests 16 ✅ 0s ⏱️ Results for commit dc6ab81. ♻️ This comment has been updated with latest results. |
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a new partitioning strategy for canonical API specifications, which is a valuable improvement for enhancing the efficiency of storing, retrieving, and comparing OpenAPI specs. The changes include new utility functions for stable stringification and hashing, along with partitioning logic based on HTTP methods and tags. While the overall approach is sound, there are a few areas that could be improved for correctness and maintainability, particularly regarding the stableStringify utility and the tag-based partitioning logic.
packages/patchlogr-core/src/partition/__tests__/partitionByMethod.test.ts
Outdated
Show resolved
Hide resolved
packages/patchlogr-core/src/partition/__tests__/partitionByMethod.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a partitioning strategy for canonical API specifications to improve storage, retrieval, and comparison efficiency as OpenAPI documents scale. The approach partitions operations by different strategies (tag, method, path prefix) rather than storing everything as a single JSON blob.
Changes:
- Added utility functions for stable JSON stringification and SHA256 hashing to support deterministic operation hashing
- Implemented two partitioning strategies:
partitionByTag(groups by first tag with fallback to DEFAULT) andpartitionByMethod(groups by HTTP method) - Removed
"type": "module"from package.json and added @types/node dependency to support Node.js crypto module
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 18 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/patchlogr-core/src/utils/stableStringify.ts | Utility to stringify JSON with sorted keys for deterministic output |
| packages/patchlogr-core/src/utils/createHash.ts | Utility to generate SHA256 hashes from strings |
| packages/patchlogr-core/src/utils/tests/stableStringify.test.ts | Unit tests for stable stringification |
| packages/patchlogr-core/src/partition/partition.ts | Type definitions for partitions and partitioned specs |
| packages/patchlogr-core/src/partition/partitionByTag.ts | Implementation of tag-based partitioning strategy |
| packages/patchlogr-core/src/partition/partitionByMethod.ts | Implementation of HTTP method-based partitioning strategy |
| packages/patchlogr-core/src/partition/tests/partitionByTag.test.ts | Tests for tag-based partitioning |
| packages/patchlogr-core/src/partition/tests/partitionByMethod.test.ts | Tests for method-based partitioning |
| packages/patchlogr-core/package.json | Updated module type and dependencies |
| yarn.lock | Added @types/node dependency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📎 Related issues
📦 Scope
📌 Summary
🧠 Context
@patchlogr/oas에서 openapi 문서를 canonical spec 으로 변환✅ Checklist