Skip to content
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

Parse all XML as proper strings (SOFIE-3006) #103

Merged
merged 5 commits into from
Aug 27, 2024

Conversation

nytamin
Copy link
Contributor

@nytamin nytamin commented Jul 5, 2024

About the Contributor

This pull request is posted on behalf of the NRK.

Type of Contribution

This is a: Bug fix / Code improvement / BIG refactoring

Current Behavior

As reported in #92, strings can be improperly parsed as numbers in incoming xml data.

This exposed a larger issue, where there where internal issues with type safety when parsing the incoming data as any.

New Behavior

  • Incoming data are no longer automatically parsed to native types (such as number or boolean).
  • All incoming data are treated as strings and converted to their specified type per-property.
  • Better error handling (a path to the failing property is now included in thrown errors).
  • Changes in types:
    • MosString128 & MosDuration no longer accepts any type
    • MOS types that had type any will now have specified types
    • roAck.Status are now of type string

Testing Instructions

This affects the whole library. While the unit tests pass, we would need to test this version in production before we merge it.

Other Information

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.

@codecov-commenter
Copy link

codecov-commenter commented Jul 5, 2024

Codecov Report

Attention: Patch coverage is 57.68421% with 402 lines in your changes missing coverage. Please review.

Project coverage is 75.28%. Comparing base (47ade0e) to head (4dd8071).

Files Patch % Lines
...ages/helper/src/mosModel/profile2/xmlConversion.ts 31.00% 62 Missing and 7 partials ⚠️
...ages/helper/src/mosModel/profile0/xmlConversion.ts 23.52% 57 Missing and 8 partials ⚠️
...ages/helper/src/mosModel/profile3/xmlConversion.ts 19.73% 58 Missing and 3 partials ⚠️
packages/helper/src/mosModel/parseMosTypes.ts 62.40% 46 Missing and 4 partials ⚠️
...ages/helper/src/mosModel/profile1/xmlConversion.ts 60.31% 49 Missing and 1 partial ⚠️
packages/helper/src/mosModel/lib.ts 66.23% 22 Missing and 4 partials ⚠️
...ages/helper/src/mosModel/profile4/xmlConversion.ts 17.39% 19 Missing ⚠️
packages/connector/src/MosConnection.ts 34.61% 17 Missing ⚠️
...ckages/connector/src/connection/mosSocketClient.ts 54.83% 14 Missing ⚠️
packages/helper/src/mosModel/ParseError.ts 75.00% 10 Missing ⚠️
... and 8 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #103      +/-   ##
==========================================
- Coverage   77.55%   75.28%   -2.28%     
==========================================
  Files          65       67       +2     
  Lines        3596     3985     +389     
  Branches      835      941     +106     
==========================================
+ Hits         2789     3000     +211     
- Misses        748      932     +184     
+ Partials       59       53       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

nytamin added 3 commits July 5, 2024 08:27
BREAKING CHANGES:

* MosString128 & MosDuration no longer accepts any type
* MOS types that had type `any` will now have specified types
* roAck.Status are now of type `string`
@nytamin nytamin force-pushed the fix/parse-everything-as-strings branch from 2964dd4 to 0f0f8d3 Compare July 5, 2024 06:59
@nytamin nytamin marked this pull request as ready for review July 5, 2024 07:03
@nytamin nytamin changed the title Parse all XML as proper strings Parse all XML as proper strings (SOFIE-3006) Jul 5, 2024
@nytamin nytamin added the enhancement New feature or request label Aug 12, 2024
# Conflicts:
#	lerna.json
#	packages/connector/package.json
#	packages/examples/package.json
#	packages/helper/package.json
#	packages/model/package.json
#	packages/quick-mos/package.json
#	yarn.lock
@nytamin nytamin requested a review from a team August 26, 2024 08:57
@nytamin nytamin merged commit 206723b into master Aug 27, 2024
16 checks passed
@nytamin nytamin deleted the fix/parse-everything-as-strings branch August 27, 2024 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants