-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add location data with schema validation #15
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,137 @@ | ||||||||||||||||||||||||
| import { getFile } from './files.js' | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| function validateParams(params) { | ||||||||||||||||||||||||
| const missing = [] | ||||||||||||||||||||||||
| for (const [key, value] of Object.entries(params)) { | ||||||||||||||||||||||||
| if (!value) missing.push(key) | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| if (missing.length > 0) { | ||||||||||||||||||||||||
| throw new Error(`Missing required parameters: ${missing.join(', ')}`) | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
Comment on lines
+2
to
+12
|
||||||||||||||||||||||||
| function validateParams(params) { | |
| const missing = [] | |
| for (const [key, value] of Object.entries(params)) { | |
| if (!value) missing.push(key) | |
| } | |
| if (missing.length > 0) { | |
| throw new Error(`Missing required parameters: ${missing.join(', ')}`) | |
| } | |
| } | |
| import { validateParams } from './lib/validateParams.js' |
Copilot
AI
Oct 29, 2025
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.
Incorrect falsy value handling: Using || will convert capacity: 0 to null. Use nullish coalescing (??) instead to preserve zero values.
| capacity: location.capacity || null, | |
| capacity: location.capacity ?? null, |
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.
The imported module './files.js' does not exist in the codebase. This will cause a runtime error when the getLocations function is called. Either create the missing files.js module or replace this with the appropriate file-fetching implementation using the graphql client directly.