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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

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 94.41%. Comparing base (939464c) to head (7fc82e0).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13694   +/-   ##
=======================================
  Coverage   94.41%   94.41%           
=======================================
  Files        1574     1574           
  Lines       21276    21276           
  Branches     2541     2541           
=======================================
  Hits        20088    20088           
  Misses        943      943           
  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
@ErlingHauan ErlingHauan added area/ui-editor Area: Related to the designer tool for assembling app UI in Altinn Studio. and removed solution/studio/code Issues related to DX, coding, debugging and testing locally. labels Oct 4, 2024
@ErlingHauan ErlingHauan changed the title fix: Make component schema script check if enum contents are numbers and refactor script fix: Refactor component script and check if enum contents are numbers 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
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
Status: 🔎 Review
Development

Successfully merging this pull request may close these issues.

1 participant