Skip to content

Conversation

@dirkwa
Copy link
Contributor

@dirkwa dirkwa commented Dec 31, 2025

This PR eliminates the lodash.get deprecation warning that appears during npm install. The warning comes from api-schema-builder → z-schema → lodash.get. Rather than waiting for upstream fixes, I replaced api-schema-builder with a lightweight custom validator built on AJV. AJV is already used elsewhere in Signal K (the admin UI uses it via @rjsf/validator-ajv8), so this doesn't introduce any new dependencies to the overall project - it just makes the existing AJV dependency explicit in the server's package.json. The new validator in src/api/validation/openapi-validator.ts provides the same interface as api-schema-builder, so the changes to the actual validation code are minimal - just import path updates.

Changes

  • Added src/api/validation/openapi-validator.ts - custom OpenAPI validator using AJV
  • Updated imports in src/api/resources/validate.ts and src/api/course/index.ts
  • Added ajv and ajv-formats as direct dependencies
  • Removed api-schema-builder dependency
  • Deleted the api-schema-builder type declaration file

Tested with manual API requests to confirms validation still works correctly

The api-schema-builder package depends on z-schema which uses the
deprecated lodash.get. Replace it with a custom OpenAPI validator
built on AJV, which is already a transitive dependency and actively
maintained.

- Add src/api/validation/openapi-validator.ts with buildSchemaSync()
- Update imports in resources/validate.ts and course/index.ts
- Add ajv and ajv-formats as direct dependencies
- Remove api-schema-builder dependency
- Delete obsolete api-schema-builder type declaration
@dirkwa
Copy link
Contributor Author

dirkwa commented Dec 31, 2025

Forgot to mention - also removes lodash.isequal, so no warn for that anymore too.

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.

1 participant