Skip to content
Permalink
Browse files
fix(candeletecardinalities): return correct response on route negativ…
…e case (DEV-36) (#1910)

* fix(cardinalities): use canDo response instead of BadRequest

* fix: return propertyIsUsed

* test: add test which confirms cardinality can't be deleted

* test: add test data

* refactor: move client test data collection to separated method

* add missing type

* refactor: improve CollectClientTestData method

* add files to expected client test data

* add missing files extensions
  • Loading branch information
mpro7 committed Sep 29, 2021
1 parent 8df70a2 commit 652c747399aac347a935f2a6dcfb061835eb4cf1
@@ -193,6 +193,10 @@ test-data/v2/ontologies/add-cardinalities-to-class-nothing-response.json
test-data/v2/ontologies/all-ontology-metadata-response.json
test-data/v2/ontologies/anything-ontology.json
test-data/v2/ontologies/can-do-response.json
test-data/v2/ontologies/candeletecardinalities-false-request.json
test-data/v2/ontologies/candeletecardinalities-false-response.json
test-data/v2/ontologies/candeletecardinalities-true-request.json
test-data/v2/ontologies/candeletecardinalities-true-response.json
test-data/v2/ontologies/change-class-comment-request.json
test-data/v2/ontologies/change-class-label-request.json
test-data/v2/ontologies/change-gui-order-request.json
@@ -129,9 +129,6 @@ object Cardinalities {

submittedPropertyToDelete: SmartIri = cardinalitiesToDelete.head._1
propertyIsUsed: Boolean <- isPropertyUsedInResources(settings, storeManager, submittedPropertyToDelete)
_ = if (propertyIsUsed) {
throw BadRequestException("Property is used in data. The cardinality cannot be deleted.")
}

// Make an update class definition in which the cardinality to delete is removed

@@ -170,7 +167,7 @@ object Cardinalities {
throw BadRequestException(msg)
}
)
} yield CanDoResponseV2(true)
} yield CanDoResponseV2(!propertyIsUsed)
}

/**

0 comments on commit 652c747

Please sign in to comment.