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

fix: Refactor component script and check if enum contents are numbers #13694

Merged
merged 16 commits into from
Oct 17, 2024

Conversation

ErlingHauan
Copy link
Contributor

@ErlingHauan ErlingHauan commented Oct 3, 2024

Description

Functional changes

Previously, when generating JSON Schemas for the components, the script always asserted that enum values were strings.
Now, the script checks the first value of the enum and asserts the type (number or string) based on that.

In addition, the console now logs definitionName: ComponentNameExternal instead of definitionName: ComponentName for v4 components, because that is the actual definition we get the component schemas from.

Refactoring

  • Used the expandRef utility function to get the external references to v4 components. This improves the quick fix from a couple of weeks ago.
  • Moved the writeToFile function into a new file called fileUtils.ts.
  • Moved many of the functions in run.ts into schemaUtils.ts and languageUtils.ts.

Related Issue(s)

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)

@ErlingHauan ErlingHauan linked an issue Oct 3, 2024 that may be closed by this pull request
@github-actions github-actions bot added area/ui-editor Area: Related to the designer tool for assembling app UI in Altinn Studio. solution/studio/designer Issues related to the Altinn Studio Designer solution. labels Oct 3, 2024
@ErlingHauan ErlingHauan linked an issue Oct 3, 2024 that may be closed by this pull request
@ErlingHauan ErlingHauan changed the title fix: Make JSON Schema script check if enum contents are numbers fix: Make component schema script check if enum contents are numbers Oct 4, 2024
@ErlingHauan ErlingHauan changed the title fix: Make component schema script check if enum contents are numbers fix: Make component schema script check if enum contents are numbers - and refactor script Oct 4, 2024
Copy link

codecov bot commented Oct 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.27%. Comparing base (2f17f0a) to head (de7126b).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13694   +/-   ##
=======================================
  Coverage   95.27%   95.27%           
=======================================
  Files        1635     1635           
  Lines       21828    21828           
  Branches     2567     2567           
=======================================
  Hits        20796    20796           
  Misses        787      787           
  Partials      245      245           

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

@ErlingHauan ErlingHauan changed the title fix: Make component schema script check if enum contents are numbers - and refactor script fix: Make component schema script check if enum contents are numbers and refactor script Oct 4, 2024
@ErlingHauan ErlingHauan force-pushed the 13673-changing-header-size-causes-error-message branch from 23da349 to 6bc116b Compare October 4, 2024 08:51
@github-actions github-actions bot added area/dashboard Area: Related to the dashboard solution/studio/repos Issues related to the Altinn Studio Repos solution (Gitea). solution/platform Issues related to Altinn Platform solutions. quality/testing Tests that are missing, needs to be created or could be improved. skip-releasenotes Issues that do not make sense to list in our release notes kind/dependencies Used for issues or pull requests that are dependency updates area/pdf labels Oct 4, 2024
@ErlingHauan ErlingHauan force-pushed the 13673-changing-header-size-causes-error-message branch from 6bc116b to 656843e Compare October 4, 2024 08:53
@ErlingHauan ErlingHauan removed area/ui-editor Area: Related to the designer tool for assembling app UI in Altinn Studio. area/dashboard Area: Related to the dashboard solution/studio/designer Issues related to the Altinn Studio Designer solution. solution/studio/repos Issues related to the Altinn Studio Repos solution (Gitea). solution/platform Issues related to Altinn Platform solutions. quality/testing Tests that are missing, needs to be created or could be improved. kind/dependencies Used for issues or pull requests that are dependency updates area/pdf labels Oct 4, 2024
@github-actions github-actions bot added the solution/studio/designer Issues related to the Altinn Studio Designer solution. label Oct 4, 2024
@ErlingHauan ErlingHauan added solution/studio/code Issues related to DX, coding, debugging and testing locally. and removed solution/studio/designer Issues related to the Altinn Studio Designer solution. labels Oct 4, 2024
@wrt95 wrt95 removed their assignment Oct 9, 2024
@ErlingHauan ErlingHauan assigned wrt95 and unassigned ErlingHauan Oct 10, 2024
@wrt95 wrt95 assigned ErlingHauan and unassigned wrt95 Oct 10, 2024
@ErlingHauan ErlingHauan assigned wrt95 and unassigned ErlingHauan Oct 11, 2024
Copy link
Contributor

@wrt95 wrt95 left a comment

Choose a reason for hiding this comment

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

Great job! 🚀
Added one nitpick

frontend/scripts/componentSchemas/schemaUtils.ts Outdated Show resolved Hide resolved
@wrt95 wrt95 assigned ErlingHauan and unassigned wrt95 Oct 14, 2024
Copy link
Contributor

@JamalAlabdullah JamalAlabdullah left a comment

Choose a reason for hiding this comment

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

Tested ok 💯

@JamalAlabdullah JamalAlabdullah merged commit 57f01e1 into main Oct 17, 2024
10 checks passed
@JamalAlabdullah JamalAlabdullah deleted the 13673-changing-header-size-causes-error-message branch October 17, 2024 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ui-editor Area: Related to the designer tool for assembling app UI in Altinn Studio. frontend skip-releasenotes Issues that do not make sense to list in our release notes solution/studio/designer Issues related to the Altinn Studio Designer solution. team/studio-domain2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing header size causes error message
3 participants