- Notifications
You must be signed in to change notification settings - Fork 5.5k
Update get-weather-data.mjs to fix querying multiple dates #18340
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
base: master
Are you sure you want to change the base?
Conversation
Dates can be described in multiple ways: Single date: YYYY-MM-DDTHHZ Time Period fixed start/end: YYYY-MM-DDTHHZ--YYYY-MM-DDTHHZ:<step>, where <step> is e.g. PT1H for hourly Time Period fixed start/length: YYYY-MM-DDTHHZP<period>:<step>, where <period> is e.g. P3D for three days. Multiple dates: YYYY-MM-DDTHHZ,YYYY-MM-DDTHHZ,YYYY-MM-DDTHHZ (comma separated. As e.g. Claude tries to join multiple dates with '--' instead of ',' because of that description. This should fix the behavior to query multiple dates
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
WalkthroughThe Get Weather Data action updates how the validDateTime string is constructed: values are now joined using a comma instead of a double dash. No other parameters, locations, format handling, or exports are changed. Changes
Sequence Diagram(s)sequenceDiagram autonumber actor Caller participant Action as GetWeatherDataAction participant API as Meteomatics API Caller->>Action: invoke getWeatherData(params, locations, validDateTimes, format) note right of Action: Build validDateTime by joining with ","<br/>(was "--") Action->>API: HTTP request with parameters, locations, validDateTime, format API-->>Action: Response (data or error) Action-->>Caller: Return parsed result Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks (2 passed, 1 warning)❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Poem
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews: pre_merge_checks: custom_checks: - name: "Undocumented Breaking Changes" mode: "warning" instructions: | Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal). Please share your feedback with us on this Discord post. ✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified. |
Thanks for submitting this PR! When we review PRs, we follow the Pipedream component guidelines. If you're not familiar, here's a quick checklist:
|
@lcaresia Thanks for writing the MCP! |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
components/meteomatics_weather_api/actions/get-weather-data/get-weather-data.mjs (1)
36-43
: Optional: normalize inputs (trim/dedupe) to reduce API 400s from user inputIf users paste CSVs with spaces or duplicates, normalize before dispatch.
You could do:
- const validdatetime = Array.isArray(this.validDateTime) - ? this.validDateTime.join(",") - : this.validDateTime; + const toCsv = (v) => + Array.isArray(v) + ? [...new Set(v.map((s) => String(s).trim()))].filter(Boolean).join(",") + : String(v).trim(); + const validdatetime = toCsv(this.validDateTime); + const parameters = toCsv(this.parameters);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
components/meteomatics_weather_api/actions/get-weather-data/get-weather-data.mjs
(1 hunks)
🔇 Additional comments (2)
components/meteomatics_weather_api/actions/get-weather-data/get-weather-data.mjs (2)
39-41
: Fix is correct: comma-join matches Meteomatics multi-date syntaxJoining
validDateTime
with","
resolves the multiple-date query bug as described. 👍
36-43
: Harden for single-string inputs to avoid.join
TypeErrorGuard when validDateTime/parameters may be single strings —
.join
throws on strings. Repo search returned no prop definitions; confirm expected types and apply this diff insiderun
:async run({ $ }) { - const response = await this.app.getWeatherData({ + const validdatetime = Array.isArray(this.validDateTime) + ? this.validDateTime.join(",") + : this.validDateTime; + const parameters = Array.isArray(this.parameters) + ? this.parameters.join(",") + : this.parameters; + const response = await this.app.getWeatherData({ $, - validdatetime: this.validDateTime.join(","), - parameters: this.parameters.join(","), + validdatetime, + parameters, locations: this.locations, format: this.format, });
Dates can be described in multiple ways:
Single date: YYYY-MM-DDTHHZ
Time Period fixed start/end: YYYY-MM-DDTHHZ--YYYY-MM-DDTHHZ:, where is e.g. PT1H for hourly Time Period fixed start/length: YYYY-MM-DDTHHZP:, where is e.g. P3D for three days.
Multiple dates: YYYY-MM-DDTHHZ,YYYY-MM-DDTHHZ,YYYY-MM-DDTHHZ (comma separated. As e.g. Claude tries to join multiple dates with '--' instead of ',' because of that description. This should fix the behavior to query multiple dates
WHY
Summary by CodeRabbit