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
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 lodash.get dependency and replaces its usage with optional chaining, default values, destructuring, and new helper functions to extract nested schemas.

  • Replaced all lodash.get calls with native optional chaining and defaults.
  • Added getSchemaFromShowOperation and getSchemaFromEditOperation helpers in the OpenAPI v3 handler.
  • Updated Hydra parser to use optional chaining for deep JSON-LD property access.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
src/swagger/handleJson.ts Removed lodash.get, used destructuring and optional chaining; refactored removeTrailingSlash.
src/openapi3/handleJson.ts Dropped lodash.get, introduced type‐guard helpers and replaced deep gets with helpers.
src/hydra/parseHydraDocumentation.ts Replaced lodash.get calls with optional chaining and default arrays/values for JSON-LD.
package.json Deleted the lodash.get dependency.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

src/openapi3/handleJson.ts:12

  • The isParameter function should include a TypeScript type predicate (: maybeParameter is OpenAPIV3.ParameterObject) so that downstream code can correctly narrow parameter types.
function isParameter(

@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
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