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

feat: refactor SchemaModelService to update appMetadata when creating new data model #14209

Conversation

standeren
Copy link
Contributor

@standeren standeren commented Nov 28, 2024

Description

Refactor SchemaModelService to update appMetadata when creating new data model:

  • Remove some functions that was executed multiple times and instead only pass the calculated value that was actually needed in the underlying functions.
  • Simplified UpdateCSharpClasses to only update csharp classes and move the logic to get the full type name out in separate method GetFullTypeName. Also created a separate function for NamespaceNeedsToBeSeparated that is now used in UpdateCSharpClasses.
  • Removed return value of UpdateModelFilesFromJsonSchema as it was not used.
  • Moved call to UpdateApplicationMetadata function from ProcessNewXsd to BuildSchemaFromXsd.
  • Changed name of ProcessNewXsd to GenerateJsonSchemaAndCSharp since that is more concrete.
  • The most crucial change is adding call to UpdateApplicationMetadata function in CreateSchemaFromTemplate.
  • Deleted SerializeModelMetadata since it was not used.

In addition I changed the name of fileName in the BuildSchemaFromXsd, which is called when uploading xsd, to fileNameWithExtension to make a clearer what variables of the name that has extensions and not.

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)

@standeren standeren linked an issue Nov 28, 2024 that may be closed by this pull request
@github-actions github-actions bot added solution/studio/designer Issues related to the Altinn Studio Designer solution. backend labels Nov 28, 2024
@github-actions github-actions bot added the quality/testing Tests that are missing, needs to be created or could be improved. label Nov 29, 2024
@standeren standeren marked this pull request as ready for review November 29, 2024 13:05
@standeren standeren added team/studio-domain1 team/studio-core skip-releasenotes Issues that do not make sense to list in our release notes skip-documentation Issues where updating documentation is not relevant labels Nov 29, 2024
@TomasEng TomasEng self-assigned this Dec 9, 2024
Copy link
Contributor

@TomasEng TomasEng left a comment

Choose a reason for hiding this comment

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

Ingenting å utsette på dette så vidt jeg kan se. Fin og utfyllende beskrivelse!

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.

Test OK 🚀

Copy link

codecov bot commented Dec 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.52%. Comparing base (37d92b5) to head (f7691ce).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14209   +/-   ##
=======================================
  Coverage   95.52%   95.52%           
=======================================
  Files        1826     1826           
  Lines       23757    23757           
  Branches     2752     2752           
=======================================
  Hits        22695    22695           
  Misses        807      807           
  Partials      255      255           

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

@ErlingHauan ErlingHauan merged commit 94be9b9 into main Dec 11, 2024
17 checks passed
@ErlingHauan ErlingHauan deleted the 14123-ensure-datamodelid-is-added-to-appmetadata-on-create-new-model branch December 11, 2024 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend quality/testing Tests that are missing, needs to be created or could be improved. skip-documentation Issues where updating documentation is not relevant 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-core team/studio-domain1
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Ensure dataModelId is added to appMetadata on create new model
4 participants