Skip to content

Refactor: Remove lodash.get dependency #154

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

J3m5
Copy link
Contributor

@J3m5 J3m5 commented Jun 14, 2025

Eliminate the lodash.get dependency and replace its usage with optional chaining, default values and type narrowing.

close #146

Copy link

github-actions bot commented Jun 14, 2025

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 70.87% (🎯 70%) 292 / 412
🟢 Statements 70.91% (🎯 70%) 295 / 416
🟢 Functions 73.23% (🎯 70%) 52 / 71
🟢 Branches 61.04% (🎯 58%) 246 / 403
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/hydra/parseHydraDocumentation.ts 87.4% 78.26% 91.66% 87.31% 34, 61-63, 69, 77-79, 83-85, 105-111, 117, 124-126, 207, 222, 280, 291-296, 381
src/openapi3/handleJson.ts 88.11% 72% 95% 88% 49, 66-70, 90, 169, 213, 220, 228, 240, 251, 319
src/swagger/handleJson.ts 80.76% 65.21% 100% 80.76% 10, 25, 34, 40, 46
Generated in workflow #225 for commit 01354c9 by the Vitest Coverage Report Action

Base automatically changed from oxlint to main June 14, 2025 17:58
@J3m5 J3m5 force-pushed the remove-lodash.get branch from 1631843 to 4a4f5ab Compare June 14, 2025 17:59
@J3m5 J3m5 requested review from dunglas, alanpoulain and soyuka June 14, 2025 18:00
@J3m5 J3m5 self-assigned this Jun 14, 2025
@J3m5 J3m5 requested a review from Copilot June 14, 2025 18:08
Copilot

This comment was marked as outdated.

@J3m5 J3m5 force-pushed the remove-lodash.get branch from 4a4f5ab to c739b9d Compare June 15, 2025 17:13
@J3m5 J3m5 force-pushed the remove-lodash.get branch from c739b9d to 01354c9 Compare June 15, 2025 17:18
@J3m5 J3m5 requested a review from Copilot June 17, 2025 07:07
Copy link

@Copilot Copilot AI left a 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 removes the dependency on lodash.get by replacing its usage with modern optional chaining, default value logic, and type narrowing.

  • Removed lodash.get from all modules and replaced with native JavaScript alternatives.
  • Refactored JSON property lookups in Swagger, OpenAPI3, and Hydra documentation handling.
  • Updated package.json to drop the lodash.get dependency.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

File Description
src/swagger/handleJson.ts Replaces lodash.get with optional chaining and improved error handling.
src/openapi3/handleJson.ts Introduces helper functions for schema extraction using native JS patterns.
src/hydra/parseHydraDocumentation.ts Updates property access via optional chaining and tighter type checks.
package.json Removes unused lodash.get dependency.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

src/swagger/handleJson.ts:40

  • Consider providing a descriptive error message rather than a generic Error to help diagnose issues.
throw new Error(); // @TODO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get rid of lodash.get
1 participant