-
Notifications
You must be signed in to change notification settings - Fork 12
fix: show thermostat sample for /thermostats/list #766
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
Conversation
codegen/lib/layout/api-endpoint.ts
Outdated
| include: [ | ||
| ...(metadata?.include_groups ?? []), | ||
| ...(parentMetadata?.include_groups ?? []), | ||
| ], | ||
| exclude: [ | ||
| ...(metadata?.exclude_groups ?? []), | ||
| ...(parentMetadata?.exclude_groups ?? []), | ||
| ], |
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.
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,
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.
@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
f52d478
into
evan/cx-417-json-response-blurbs-for-specialized-devices-need-to-show
* 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]>
Extension of #711
Not sure if correct, but
parentPathis the only thing I could find to link it to the path metadata.