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(subform): Add GET and PUT endpoints for datamodel metadata #14275

Merged
merged 10 commits into from
Dec 23, 2024

Conversation

Jondyr
Copy link
Member

@Jondyr Jondyr commented Dec 12, 2024

Description

  • Backend endpoints to update metadata/datatype for a datamodel.
  • SchemaModelServiceTests refactored to setup service correctly after changes to SchemaModelService's constructor

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)

Documentation

  • User documentation is updated with a separate linked PR in altinn-studio-docs. (if applicable)

@github-actions github-actions bot added solution/studio/designer Issues related to the Altinn Studio Designer solution. backend labels Dec 12, 2024
@Jondyr Jondyr changed the title Add GET and PUT endpoints for datamodel metadata feat(subform): Add GET and PUT endpoints for datamodel metadata Dec 12, 2024
@github-actions github-actions bot added the quality/testing Tests that are missing, needs to be created or could be improved. label Dec 12, 2024
@Jondyr Jondyr force-pushed the 12-12-backend_endpoints_for_datamodel_metadata branch from fe7279e to 3fa946f Compare December 12, 2024 13:33
@Jondyr Jondyr added team/studio-domain1 team/studio-domain2 area/data-modeling Area: Related to data models - e.g. create, edit, use data models. and removed quality/testing Tests that are missing, needs to be created or could be improved. labels Dec 12, 2024
Copy link

codecov bot commented Dec 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.56%. Comparing base (cc8754c) to head (ebeceae).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14275   +/-   ##
=======================================
  Coverage   95.56%   95.56%           
=======================================
  Files        1843     1843           
  Lines       23886    23886           
  Branches     2752     2752           
=======================================
  Hits        22827    22827           
  Misses        802      802           
  Partials      257      257           

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

@github-actions github-actions bot added the quality/testing Tests that are missing, needs to be created or could be improved. label Dec 12, 2024
@Jondyr Jondyr marked this pull request as ready for review December 12, 2024 14:00
@Jondyr Jondyr force-pushed the 12-12-backend_endpoints_for_datamodel_metadata branch 4 times, most recently from 4f97aec to f2e79a3 Compare December 17, 2024 12:06
@standeren
Copy link
Contributor

I thought this PR was about getting the verbose metadata for the actual data model, which we already have endpoints for in appDevelopmentController, but when looking closer at it I see that it is about the application metadata and not the model metadata. We should first of all adjust the naming of the methods in this PR to not be confused with the appDev GetModelMetadata endpoint.

But also I wonder if this is necessary? We already have endpoints for getting the appmetadatafile which is cached so I guess we do not improve performance much by getting the specific dataType from the api 🤷

Maybe it makes more sense adding a put endpoint in the ApplicationMetadataController?

@Jondyr
Copy link
Member Author

Jondyr commented Dec 18, 2024

@standeren

I thought this PR was about getting the verbose metadata for the actual data model, which we already have endpoints for in appDevelopmentController, but when looking closer at it I see that it is about the application metadata and not the model metadata. We should first of all adjust the naming of the methods in this PR to not be confused with the appDev GetModelMetadata endpoint.

Good point, i agree the naming here should be better. I think "metadata" might be a too generic word that doesn't convey enough context. I think "datatype" is used when referring to this data, what do you think about switching out "metadata" with "datatype" for the endpoint naming?

But also I wonder if this is necessary? We already have endpoints for getting the appmetadatafile which is cached so I guess we do not improve performance much by getting the specific dataType from the api 🤷

The idea here is to avoid unnecessary logic on the frontend, and at the same time make the API more adaptable (e.g. if we move to a custom or internal format in the future).
I agree that there is likely no performance gain (more likely a little loss) but i think focusing solely on performance misses the bigger picture.

Maybe it makes more sense adding a put endpoint in the ApplicationMetadataController?

I disagree, because I think ideally the frontend and controller layer should not need to know where the storage places the information, just what the infomation is related to. And in the context of a datamodel it makes sense to me to have endpoints that alter a datamodels information in the controller for datamodels.

@Jondyr Jondyr assigned standeren and unassigned Jondyr Dec 18, 2024
@standeren
Copy link
Contributor

@standeren

Good point, i agree the naming here should be better. I think "metadata" might be a too generic word that doesn't convey enough context. I think "datatype" is used when referring to this data, what do you think about switching out "metadata" with "datatype" for the endpoint naming?

Agree.

The idea here is to avoid unnecessary logic on the frontend, and at the same time make the API more adaptable (e.g. if we move to a custom or internal format in the future). I agree that there is likely no performance gain (more likely a little loss) but i think focusing solely on performance misses the bigger picture.

👍

I disagree, because I think ideally the frontend and controller layer should not need to know where the storage places the information, just what the infomation is related to. And in the context of a datamodel it makes sense to me to have endpoints that alter a datamodels information in the controller for datamodels.

👍
But then I think we should emphasize that we are altering the applicationmetadata in the method-names inside SchemaModelService, as mentioned in the other comment 😊

@standeren standeren assigned Jondyr and unassigned standeren Dec 18, 2024
@Jondyr Jondyr force-pushed the 12-12-backend_endpoints_for_datamodel_metadata branch from f2e79a3 to 005a02e Compare December 18, 2024 09:12
@Jondyr Jondyr assigned standeren and unassigned Jondyr Dec 18, 2024
@Jondyr Jondyr force-pushed the 12-12-backend_endpoints_for_datamodel_metadata branch from 3203cd3 to 0e2690b Compare December 18, 2024 11:33
Copy link
Contributor

@standeren standeren left a comment

Choose a reason for hiding this comment

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

Just a few comments! 👏

And should we add tests for these endpoints in the dataModelController?

@standeren standeren assigned Jondyr and unassigned standeren Dec 18, 2024
@Jondyr Jondyr force-pushed the 12-12-backend_endpoints_for_datamodel_metadata branch from 409ad95 to 3f00e04 Compare December 19, 2024 10:12
@Jondyr Jondyr requested a review from standeren December 19, 2024 11:53
@Jondyr Jondyr assigned standeren and unassigned Jondyr Dec 19, 2024
Copy link
Contributor

@standeren standeren left a comment

Choose a reason for hiding this comment

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

LGTM 🫡

@standeren standeren assigned Jondyr and unassigned standeren Dec 19, 2024
@Jondyr Jondyr removed their assignment Dec 23, 2024
@Jondyr Jondyr added the skip-manual-testing PRs that do not need to be tested manually label Dec 23, 2024
@Jondyr Jondyr force-pushed the 12-12-backend_endpoints_for_datamodel_metadata branch from 081c4ac to ebeceae Compare December 23, 2024 07:02
@Jondyr Jondyr merged commit ce1ab8b into main Dec 23, 2024
17 checks passed
@Jondyr Jondyr deleted the 12-12-backend_endpoints_for_datamodel_metadata branch December 23, 2024 07:19
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. backend quality/testing Tests that are missing, needs to be created or could be improved. skip-manual-testing PRs that do not need to be tested manually solution/studio/designer Issues related to the Altinn Studio Designer solution. team/studio-domain1 team/studio-domain2
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants