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

refactor: Refactor the SchemaModel class with a base class #13812

Merged
merged 4 commits into from
Oct 21, 2024

Conversation

TomasEng
Copy link
Contributor

@TomasEng TomasEng commented Oct 17, 2024

Description

Moved some basic, non-modifying methods from SchemaModel to a new class named SchemaModelBase, which is used a base for the SchemaModel class. This new class will be used as a base class when splitting up SchemaModel into several classes with different responsibilities.

This implies that the added method in #13783 can be rewritten like this:

  public willResultInCircularReferences(
    childSchemaPointer: string,
    parentSchemaPointer: string,
  ): boolean {
    const circularReferenceDetector = new CircularReferenceDetector(this.nodeMap);
    return circularReferenceDetector.willResultInCircularReferences(childSchemaPointer, parentSchemaPointer);
  }

Here, CircularReferenceDetector is a class that extends SchemaModelBase and contains all the relevant private methods.

Related Issues

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)

@github-actions github-actions bot added area/data-modeling Area: Related to data models - e.g. create, edit, use data models. solution/studio/designer Issues related to the Altinn Studio Designer solution. frontend labels Oct 17, 2024
@TomasEng TomasEng changed the title Refactor the SchemaModel class with a base class refactor: Refactor the SchemaModel class with a base class Oct 17, 2024
@TomasEng TomasEng added skip-releasenotes Issues that do not make sense to list in our release notes team/studio-domain1 skip-manual-testing PRs that do not need to be tested manually skip-documentation Issues where updating documentation is not relevant labels Oct 17, 2024
Copy link

codecov bot commented Oct 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.30%. Comparing base (31d5ec1) to head (b6e9b0c).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13812   +/-   ##
=======================================
  Coverage   95.29%   95.30%           
=======================================
  Files        1648     1650    +2     
  Lines       21956    21963    +7     
  Branches     2581     2581           
=======================================
+ Hits        20924    20931    +7     
  Misses        787      787           
  Partials      245      245           

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

@TomasEng TomasEng marked this pull request as ready for review October 17, 2024 10:34
@ErlingHauan ErlingHauan self-assigned this Oct 21, 2024
Copy link
Contributor

@ErlingHauan ErlingHauan left a comment

Choose a reason for hiding this comment

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

Godt jobbet! Fint å få delt opp denne koden litt.

@ErlingHauan ErlingHauan merged commit a12dd61 into main Oct 21, 2024
9 checks passed
@ErlingHauan ErlingHauan deleted the refactor-schema-model branch October 21, 2024 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/data-modeling Area: Related to data models - e.g. create, edit, use data models. frontend skip-documentation Issues where updating documentation is not relevant skip-manual-testing PRs that do not need to be tested manually 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-domain1
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants