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

Feature/1693 api v3 delete recreate #2055

Merged
merged 90 commits into from
May 24, 2022

Conversation

dk1844
Copy link
Contributor

@dk1844 dk1844 commented Apr 28, 2022

  • usedIn functionality both for .../{name}/used-in and .../{name}/{version}/used-in exists
    • for depencies of: schema->dataset, schema->mapping tables, mapping tables -> dataset, propdef->dataset (all based on version-less used-in)
  • disable for entities via DELETE .../{name}, enable for entities via PUT .../{name}
    • enable/disable is done for the whole entity (all versions at once), changes only possible on enabled entities (!isDisabled check).
  • UsedIn normalization, empty - V2 had it mixed (sometimes None, sometimes Some(Seq.empty) -> now it all Nones. + unittest
  • all of the above reflected in integTests.

Partially implements #1693

Release notes suggestion

Both /api-v3/{datasets|schemas|mapping-tables|property-defintions}/{name}/used-in and /api-v3/{datasets|schemas|mapping-tables|property-defintions}/{name}/{version}/used-in REST API V3 added, the former is used for disable requests to check the dependencies. UsedIn normalization introduced.

dk1844 added 30 commits March 7, 2022 15:35
…e contours, empty DatasetControllerV3 to test
 - login allowed at /api/login & /api-v3/login
 - v2/v3 BaseRestApiTest distinquished
…st and post-import + IT to prove correct behavior
…mport + IT to prove correct behavior - fix with common location processing with segment stripping (+normalization)
…ion} now works for # or 'latest' (IT = regression test)
…{name}/{version} and /{name}/latest - improved
…- supports latest for as version-expression, impl for datasets improved by actual existence checking + IT test cases for non-existing/non-latest queries
…properties - supports latest for as version-expression; get impl is unvalidated, put impl checks validity

 - login is now common, under /api/login for both v2 and v3 (did not work previously)
…properties - supports latest for as version-expression; get impl is unvalidated, put impl checks validity - extended for different validation cases

 - login is now common, under /api/login for both v2 and v3 (did not work previously)
…ture -> CompletableFuture (mistake reverted)
… added. IT mostly adjusted, but there are todos

 - DatasetServiceV3 introduced to carry difference in behavior to DatasetService. original entity validation has been divided into create-validation and regular-entity validation.
 - buildfix for VersionedModelServiceTest
…asets/dsName/version/rules, GET datasets/dsName/version/rules/# + IT
 - v2 ignores this added information
 - needs
@dk1844 dk1844 requested a review from Zejnilovic May 9, 2022 08:13
dk1844 added 5 commits May 9, 2022 10:37
… with `MappingTableControllerV3.withMappingTableToResponse`
% Conflicts:
%	rest-api/src/main/scala/za/co/absa/enceladus/rest_api/controllers/SchemaController.scala
%	rest-api/src/main/scala/za/co/absa/enceladus/rest_api/controllers/v3/VersionedModelControllerV3.scala
%	rest-api/src/main/scala/za/co/absa/enceladus/rest_api/services/SchemaService.scala
%	rest-api/src/main/scala/za/co/absa/enceladus/rest_api/services/VersionedModelService.scala
%	rest-api/src/test/scala/za/co/absa/enceladus/rest_api/integration/controllers/v3/DatasetControllerV3IntegrationSuite.scala
…3-delete-recreate

% Conflicts:
%	rest-api/src/test/scala/za/co/absa/enceladus/rest_api/integration/controllers/v3/DatasetControllerV3IntegrationSuite.scala
Base automatically changed from feature/1693-api-v3-schema-etc to develop-ver-3.0 May 10, 2022 09:28
% Conflicts:
%	rest-api/src/main/scala/za/co/absa/enceladus/rest_api/controllers/v3/PropertyDefinitionControllerV3.scala
%	rest-api/src/main/scala/za/co/absa/enceladus/rest_api/services/v3/MappingTableServiceV3.scala
%	rest-api/src/main/scala/za/co/absa/enceladus/rest_api/services/v3/SchemaServiceV3.scala
%	rest-api/src/test/scala/za/co/absa/enceladus/rest_api/integration/controllers/v3/MappingTableControllerV3IntegrationSuite.scala
%	rest-api/src/test/scala/za/co/absa/enceladus/rest_api/integration/controllers/v3/PropertyDefinitionControllerV3IntegrationSuite.scala
%	rest-api/src/test/scala/za/co/absa/enceladus/rest_api/integration/controllers/v3/SchemaControllerV3IntegrationSuite.scala
Copy link
Contributor

@Zejnilovic Zejnilovic left a comment

Choose a reason for hiding this comment

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

Tested the disabling and enabling + used-in on name and on name+version.

I am curious. When entity is disable and somebody knows its name he can still "use it" which seems a tad weird. Maybe we should come up with a definition of disabled. Like

  • disallow all PUT/POST calls except for PUT on /{name} to enable.
  • validate should return error disabled so it cannot be run in spark-jobs.
  • maybe also:
    • disallow export
    • disallow audit-trail
    • on GET /{name} print name, version and disabled true/false (in general not just here)
    • on GET /{name}/{version} just print basic info and say it is disabled

Happy to discuss more

@Zejnilovic
Copy link
Contributor

Tested the disabling and enabling + used-in on name and on name+version.

I am curious. When entity is disable and somebody knows its name he can still "use it" which seems a tad weird. Maybe we should come up with a definition of disabled. Like

  • disallow all PUT/POST calls except for PUT on /{name} to enable.

  • validate should return error disabled so it cannot be run in spark-jobs.

  • maybe also:

    • disallow export
    • disallow audit-trail
    • on GET /{name} print name, version and disabled true/false (in general not just here)
    • on GET /{name}/{version} just print basic info and say it is disabled

Happy to discuss more

We agreed on:

  • disallow all PUT/POST calls except for PUT on /{name} to enable.
  • validate should return error disabled so it cannot be run in spark-jobs.
  • on GET /{name} print name, version and status

…bled` information - mainly on GET ...{/name}
@dk1844
Copy link
Contributor Author

dk1844 commented May 12, 2022

We agreed on:

  • on GET /{name} print name, version and status
  • implemented for V3 API by adding the disabled field to that "summary"

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 18 Code Smells

No Coverage information No Coverage information
4.9% 4.9% Duplication

Copy link
Contributor

@AdrianOlosutean AdrianOlosutean left a comment

Choose a reason for hiding this comment

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

Nice job, looks good to me. Code reviewed

Copy link
Contributor

@Zejnilovic Zejnilovic left a comment

Choose a reason for hiding this comment

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

Reviewed, built, run.

@Zejnilovic Zejnilovic added the PR:tested Only for PR - PR was tested by a tester (person) label May 19, 2022
@dk1844 dk1844 merged commit 0c9bf73 into develop-ver-3.0 May 24, 2022
@dk1844 dk1844 deleted the feature/1693-api-v3-delete-recreate branch May 24, 2022 09:44
@@ -57,14 +58,12 @@ class DatasetControllerV3 @Autowired()(datasetService: DatasetServiceV3)
case Some((entity, validation)) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouln't this endpoint have the same validation?

@dk1844 dk1844 linked an issue Jun 7, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR:tested Only for PR - PR was tested by a tester (person)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Experimental API 3 - Versioned Model
3 participants