Skip to content

feat: add inventory response validator#36

Closed
JustAzul wants to merge 1 commit intomasterfrom
test/kody-real-review
Closed

feat: add inventory response validator#36
JustAzul wants to merge 1 commit intomasterfrom
test/kody-real-review

Conversation

@JustAzul
Copy link
Copy Markdown
Owner

@JustAzul JustAzul commented Mar 29, 2026

Pull Request Description

Summary

This PR adds a new utility function to validate and process Steam inventory API responses by merging asset data with their corresponding descriptions.

What Changed

  • Added: New file src/utils/validate-response.js containing the validateInventoryResponse function
  • Purpose: Processes Steam inventory responses to combine asset data with detailed item descriptions

Functional Impact

The Steam inventory API returns data in two separate arrays:

  • assets: Contains basic item information (classid, instanceid, etc.)
  • descriptions: Contains detailed item metadata

This utility:

  1. Validates the response data structure
  2. Creates a lookup map indexed by classid and instanceid
  3. Merges assets with their corresponding descriptions into unified objects
  4. Returns an array of complete item objects ready for use

This simplifies downstream processing by providing a single, enriched dataset instead of requiring consumers to manually join assets with descriptions.

Technical Details

  • Returns null for invalid/empty input
  • Uses object key composition (classid_instanceid) for efficient lookups
  • Employs Object.assign() to merge asset and description properties

@kodus-review
Copy link
Copy Markdown

kodus-review bot commented Mar 29, 2026

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug
Performance
Security
Cross File
Business Logic

Access your configuration settings here.

@JustAzul
Copy link
Copy Markdown
Owner Author

Kody end-to-end review confirmed working.

@JustAzul JustAzul closed this Mar 30, 2026
@JustAzul JustAzul deleted the test/kody-real-review branch March 30, 2026 00:01
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