Skip to content

fix: add all sourcelayer properties to type conversion functions#1787

Open
imaretic wants to merge 3 commits into
Sofie-Automation:mainfrom
evs-broadcast:contribute/sourcelayer-conversion-functions-bug
Open

fix: add all sourcelayer properties to type conversion functions#1787
imaretic wants to merge 3 commits into
Sofie-Automation:mainfrom
evs-broadcast:contribute/sourcelayer-conversion-functions-bug

Conversation

@imaretic

Copy link
Copy Markdown
Contributor

About the Contributor

This PR is posted on behalf of EVS Broadcast Equipment.

Type of Contribution

This is a: Bug fix

Current Behavior

The REST API v1 sourceLayerFrom() and APISourceLayerFrom() type conversion functions were incomplete. When converting between the internal ISourceLayer type and the REST API's APISourceLayer type, some source layer properties were silently dropped.

This meant:

  • Reading a source layer via the REST API returned an incomplete object (missing those fields).
  • Creating/updating a source layer via the REST API silently discarded those properties, losing the configuration.

New Behavior

Both conversion functions (sourceLayerFrom and APISourceLayerFrom) now map all the missing source layer properties between ISourceLayer and APISourceLayer. The APISourceLayer interface has also been extended with these optional fields so the REST API contract correctly reflects the full source layer configuration.

Testing

  • I have added one or more unit tests for this PR
  • I have updated the relevant unit tests
  • No unit test changes are needed for this PR

Affected areas

This PR affects the REST API v1 Show Style endpoints, specifically the source layer create/update/read operations.
Any consumer using the REST API to manage source layers on a Show Style Base will now correctly read and write all source layer properties that were previously silently ignored.

Time Frame

Not urgent.

Status

  • PR is ready to be reviewed.
  • The functionality has been tested by the author.
  • Relevant unit tests has been added / updated.
  • Relevant documentation (code comments, system documentation) has been added / updated.

@imaretic imaretic added the Contribution from EVS Contributions sponsored by EVS Broadcast Equipment (evs.com) label Jun 30, 2026
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 05e0e438-338d-4bee-af94-c15b10f04579

📥 Commits

Reviewing files that changed from the base of the PR and between f36d879 and 31b6452.

⛔ Files ignored due to path filters (1)
  • packages/openapi/src/generated/openapi.yaml is excluded by !**/generated/**
📒 Files selected for processing (2)
  • meteor/server/api/rest/v1/typeConversion.ts
  • packages/openapi/api/definitions/showstyles.yaml

Walkthrough

The APISourceLayer interface is extended with 11 new optional boolean fields covering remote/guest input, clearable/sticky/queueable/hidden behavior, disable allowance, and presenter/list-view column configuration. Conversion functions sourceLayerFrom and APISourceLayerFrom map these fields bidirectionally and now return Complete<...> types. The OpenAPI schema is updated to match, also expanding the layerType enum.

Changes

APISourceLayer Field Expansion

Layer / File(s) Summary
APISourceLayer interface and bidirectional conversion
meteor/server/lib/rest/v1/showstyles.ts, meteor/server/api/rest/v1/typeConversion.ts
APISourceLayer gains 11 optional boolean fields; sourceLayerFrom and APISourceLayerFrom are updated to map these fields to/from ISourceLayer and now return Complete<ISourceLayer> and Complete<APISourceLayer> respectively.
OpenAPI schema update for sourceLayer
packages/openapi/api/definitions/showstyles.yaml
The sourceLayer.layerType enum is expanded with new values, and the sourceLayer schema adds matching boolean properties describing input, lifecycle, and display behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: completing sourceLayer property mapping in the type conversion functions.
Description check ✅ Passed The description matches the code changes, including the conversion fixes and the updated REST API sourceLayer contract.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 35 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
meteor/server/api/rest/v1/typeConversion.ts 0.00% 24 Missing ⚠️
meteor/server/lib/rest/v1/showstyles.ts 0.00% 11 Missing ⚠️

📢 Thoughts on this report? Let us know!

@imaretic imaretic marked this pull request as ready for review June 30, 2026 12:19
@Julusian

Julusian commented Jul 1, 2026

Copy link
Copy Markdown
Member

should the openapi yaml be updated to reflect this too?

If you make these functions use the Complete<X> interface, then typescript will ensure that all the properties are defined, while still allowing them to be set to undefined. That will stop this regressing in the future as more properties are added
image

export function sourceLayerFrom(apiSourceLayer: APISourceLayer): Complete<ISourceLayer> {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Contribution from EVS Contributions sponsored by EVS Broadcast Equipment (evs.com)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants