Skip to content

Conversation

@mikewuu
Copy link
Contributor

@mikewuu mikewuu commented Jul 29, 2025

Extension of #711

Not sure if correct, but parentPath is the only thing I could find to link it to the path metadata.

@mikewuu mikewuu requested a review from a team as a code owner July 29, 2025 08:31
@seambot seambot requested a review from a team as a code owner July 29, 2025 08:32
@mikewuu mikewuu changed the title include parent metadata fix: show thermostat sample for /thermostats/list Jul 29, 2025
Comment on lines 300 to 307
include: [
...(metadata?.include_groups ?? []),
...(parentMetadata?.include_groups ?? []),
],
exclude: [
...(metadata?.exclude_groups ?? []),
...(parentMetadata?.exclude_groups ?? []),
],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might be the key, however not quite as this has removed the samples from every endpoint which is not what we wanted.

The issue is the array merge. The logic needs to be something like

let metadata = null
if endpointMetadata?.include_groups || endpointMetadata?.exclude_groups
   metadata = endpointMetadata
if parentMetadata?.include_groups || parentMetadata?.exclude_groups
   metadata = parentMetadata

// ...
      include: metadata?.include_groups,
      exclude: metadata?.exclude_groups,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@razor-x preferring parent metadata ended up removing the sample for certain endpoints (e.g /heat /heat_cool).

Updated it to fallback to endpoint metadata if parent isn't defined, which seems to have fixed it:

  • noise sensors list updated to use noise sensor sample
  • thermostat list returns thermostat sample

@mikewuu mikewuu merged commit f52d478 into evan/cx-417-json-response-blurbs-for-specialized-devices-need-to-show Jul 30, 2025
4 checks passed
@mikewuu mikewuu deleted the mike/cx-417-json-response-blurbs-for-specialized-devices-need-to-show branch July 30, 2025 13:26
mikewuu added a commit that referenced this pull request Jul 30, 2025
* fix: Filter resourceSamples on endpoints like on route

* Remove strict check

* fix: show thermostat sample for /thermostats/list (#766)

* include parent metadata

* ci: Generate docs

* update to only select  parent metadata

* ci: Generate docs

* fallback endpoint sample

* ci: Generate docs

---------

Co-authored-by: Seam Bot <[email protected]>

---------

Co-authored-by: Mike Wu <[email protected]>
Co-authored-by: Seam Bot <[email protected]>
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.

4 participants