-
Notifications
You must be signed in to change notification settings - Fork 14
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/1569 dataset properties def #1597
Conversation
…ion of sealed trait - case classes is quite hideous: { _t : TypeName}.
199e4ea
to
581ad2b
Compare
…erties/datasets (this aligns things with the base controller providing other endpoints like /list, etc.)
…ods where possible - just aliased to gain as much consistency as possible
…efinition seems to work. Example: ``` { "errors": { "enumAbc1": [ "Value bogusEnumValue of key 'enumAbc1' does not conform to the property type of StringEnumPropertyType(Set(optionA, optionB, optionC))" ], "testKey2": [ "There is no property definition for key 'testKey2'." ], "requiredKey1": [ "Dataset property requiredKey1 is mandatory, but does not exist!" ] } } ```
…when mandatory+disabled = should not be present)
PropDef - suggestedValue is now part of propertyType, typeSpecificSettings removed.
…/properties/datasets) added to the controller, integTest covered
…header for 201)
…efinition: latest) + integTest update Dao: getDatasetPropertiesValidation Validation class shared to Dao
...st/scala/za/co/absa/enceladus/menas/integration/controllers/DatasetApiIntegrationSuite.scala
Show resolved
Hide resolved
…once at /api/dataset/{datasetName}/{datasetVersion}?validateProperties=true|false
…atasetVersion}?validateProperties=true|false, MenasDAO updated to use it + std spark-job, too. TODO spark job test
…e common job exec fails on invalid dataset properties from DAO
… is now configurable (config key is "control.info.dataset.properties.prefix", default value: "")
…onal} are excluded from json serialization
…nt.version} -> ${project.parent.version}
menas/src/main/scala/za/co/absa/enceladus/menas/controllers/PropertyDefinitionController.scala
Show resolved
Hide resolved
menas/src/main/scala/za/co/absa/enceladus/menas/controllers/PropertyDefinitionController.scala
Show resolved
Hide resolved
menas/src/main/scala/za/co/absa/enceladus/menas/controllers/PropertyDefinitionController.scala
Show resolved
Hide resolved
data-model/src/main/scala/za/co/absa/enceladus/model/properties/propertyType/package.scala
Outdated
Show resolved
Hide resolved
data-model/src/test/scala/za/co/absa/enceladus/model/PropertyDefinitionTest.scala
Outdated
Show resolved
Hide resolved
menas/src/main/scala/za/co/absa/enceladus/menas/controllers/PropertyDefinitionController.scala
Outdated
Show resolved
Hide resolved
…allowed values + tests + import hasValidNameChars regex fix (@Zejnilovic's mini request)
@@ -48,17 +48,19 @@ package object propertyType { | |||
|
|||
isValueConforming(suggestedValue) match { | |||
case Success(_) => | |||
case Failure(e) => new IllegalArgumentException(s"The suggested value $suggestedValue cannot be used.", e) | |||
case Failure(e) => throw PropertyTypeValidationException(s"The suggested value $suggestedValue cannot be used: ${e.getMessage}", e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach returns to the user. Maybe we could catch it sooner? Return Validation somewhere? We could also keep it after the REST API Audit as this is not the only one.
Typedefinitionerror: [
simpletype,
classza.co.absa.enceladus.model.properties.propertyType.package$EnumPropertyType
];nestedexceptioniscom.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannotconstructinstanceof`za.co.absa.enceladus.model.properties.propertyType.package$EnumPropertyType`,
problem: ThesuggestedvalueoptionDcannotbeused: Value'optionD'isnotoneoftheallowedvalues(optionA,
optionB,
optionC).at[
Source: (PushbackInputStream);line: 7,
column: 2
](throughreferencechain: za.co.absa.enceladus.model.properties.PropertyDefinition[
"propertyType"
])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have adjusted the ExceptionHandler to include the message from our PropertyTypeValidationException
if found as a L2 underlying cause, otherwise, the "generic" L0 message is used. The relevant integTest has been changed to reflect this. Hope you like it 🥇
…d by PropertyTypeValidationException, react with most specific errorMessage to the REST API client
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Pilot implementation of #1569
UI implementation is not part of this PR; properties & property definitions (PDs) are now Rest API-managed only.
Rest API exists for PD management and for Dataset properties management.
properties whose PDs have
putIntoInfoFile=true
are added into_INFO
file's metadata with the key beingstd_ds_
prefix in the Standardization phase, Conformance phase is not affected.Pilot limitations: only String and EnumString type properties are supported now.
Dataset API
View dataset with properties:
GET /api/dataset/{datasetName}
orGET /api/dataset/{datasetName}/{datasetVersion}
-> e.g.View properties of a dataset:
GET /api/dataset/{datasetName}/properties
-> e.g.Replace properties of a dataset:
PUT /api/dataset/{datasetName}/properties
with payload-> e.g.
(
201 Created
with headerLocation
:/api/dataset/MyDataset/7
)Dataset properties validation
GET /api/dataset/{datasetName}/{datasetVersion}/properties/valid
-> e.g.{ "errors": {} }
or
Dataset with validated properties (added in Review)
GET /api/dataset/{datasetName}/{datasetVersion}?validateProperties=true
-> e.g.(if
validateProperties
is false/missing/invalid, properties are not validated)Dataset Properties Definition API
View all property definitions at-once (latest version)
GET /api/properties/datasets
-> e.g.View specific property
GET /api/properties/datasets/{pdName}
(latest-version) orGET /api/properties/datasets/{pdName}/{pdVerison}
-> e.g.Create a new Property Definition
POST /api/properties/datasets
with payload-> e.g.
(
201 Created
with headerLocation
:/api/properties/datasets/myPdKey2/1
)Test-runs:
Spark-job run is guarded with having valid properties:
(tested with std job run):
Required property missing:
Property value conformance fails:
Undefined property is present:
A property key/value is written into the _INFO file:
A property definition with
putIntoInfoFile
=true
exists:GET http://localhost:8080/menas_exploded/api/properties/datasets/requiredKey1
->The dataset has such a field defined:
GET http://localhost:8080/menas_exploded/api/dataset/Cobol1/properties
->A key being written into the
_INFO
file:Known issues
/api/dataset/{name}/{version}/properties
will include properties that do not have an existing property definition in the system (because PD are not retrieved at this time ("orphaned properties"). (Should they be?)). When filtering is used, e.g./api/datase/{name}/properties?putIntoInfoFile=false
, such orphaned properties are dropped. However, even if filtering is used with an invalid filter (/api/datase/{name}/properties?putIntoInfoFile=bogus
), this fallbacks to only PD-backed properties being returned. Thus, the orphaned properties are dropped, too.