diff --git a/sda/internal/schema/schema_test.go b/sda/internal/schema/schema_test.go index f09830add..bb36014f7 100644 --- a/sda/internal/schema/schema_test.go +++ b/sda/internal/schema/schema_test.go @@ -76,10 +76,11 @@ func TestValidateJSONDatasetRelease(t *testing.T) { msg, _ := json.Marshal(okMsg) assert.Nil(t, ValidateJSON(fmt.Sprintf("%s/federated/dataset-release.json", schemaPath), msg)) + assert.Nil(t, ValidateJSON(fmt.Sprintf("%s/isolated/dataset-release.json", schemaPath), msg)) badMsg := DatasetMapping{ Type: "release", - DatasetID: "ABCD00123456789", + DatasetID: "", AccessionIDs: []string{ "c177c69c-dcc6-4174-8740-919b8f994122", }, @@ -87,6 +88,7 @@ func TestValidateJSONDatasetRelease(t *testing.T) { msg, _ = json.Marshal(badMsg) assert.Error(t, ValidateJSON(fmt.Sprintf("%s/federated/dataset-release.json", schemaPath), msg)) + assert.Error(t, ValidateJSON(fmt.Sprintf("%s/isolated/dataset-release.json", schemaPath), msg)) } func TestValidateJSONInboxRemove(t *testing.T) { @@ -215,18 +217,21 @@ func TestValidateJSONIngestionAccession(t *testing.T) { msg, _ := json.Marshal(okMsg) assert.Nil(t, ValidateJSON(fmt.Sprintf("%s/federated/ingestion-accession.json", schemaPath), msg)) + assert.Nil(t, ValidateJSON(fmt.Sprintf("%s/isolated/ingestion-accession.json", schemaPath), msg)) badMsg := IngestionAccession{ User: "JohnDoe", FilePath: "path/to file", - AccessionID: "ABCD00123456789", + AccessionID: "", DecryptedChecksums: []Checksums{ {Type: "sha256", Value: "da886a89637d125ef9f15f6d676357f3a9e5e10306929f0bad246375af89c2e2"}, + {Type: "md5", Value: "68b329da9893e34099c7d8ad5cb9c940"}, }, } msg, _ = json.Marshal(badMsg) assert.Error(t, ValidateJSON(fmt.Sprintf("%s/federated/ingestion-accession.json", schemaPath), msg)) + assert.Error(t, ValidateJSON(fmt.Sprintf("%s/isolated/ingestion-accession.json", schemaPath), msg)) } func TestValidateJSONIngestionCompletion(t *testing.T) { @@ -242,11 +247,12 @@ func TestValidateJSONIngestionCompletion(t *testing.T) { msg, _ := json.Marshal(okMsg) assert.Nil(t, ValidateJSON(fmt.Sprintf("%s/federated/ingestion-completion.json", schemaPath), msg)) + assert.Nil(t, ValidateJSON(fmt.Sprintf("%s/isolated/ingestion-completion.json", schemaPath), msg)) badMsg := IngestionCompletion{ User: "JohnDoe", FilePath: "path/to file", - AccessionID: "EGAF00123456789", + AccessionID: "", DecryptedChecksums: []Checksums{ {Type: "md5", Value: "68b329da9893e34099c7d8ad5cb9c940"}, }, @@ -254,6 +260,7 @@ func TestValidateJSONIngestionCompletion(t *testing.T) { msg, _ = json.Marshal(badMsg) assert.Error(t, ValidateJSON(fmt.Sprintf("%s/federated/ingestion-completion.json", schemaPath), msg)) + assert.Error(t, ValidateJSON(fmt.Sprintf("%s/isolated/ingestion-completion.json", schemaPath), msg)) } func TestValidateJSONIngestionTrigger(t *testing.T) { @@ -274,6 +281,7 @@ func TestValidateJSONIngestionTrigger(t *testing.T) { msg, _ = json.Marshal(badMsg) assert.Error(t, ValidateJSON(fmt.Sprintf("%s/federated/ingestion-trigger.json", schemaPath), msg)) + assert.Error(t, ValidateJSON(fmt.Sprintf("%s/isolated/ingestion-trigger.json", schemaPath), msg)) } func TestValidateJSONIngestionUserError(t *testing.T) { @@ -374,9 +382,10 @@ func TestValidateJSONIsloatedIngestionAccession(t *testing.T) { badMsg := IngestionAccession{ User: "JohnDoe", FilePath: "path/to file", - AccessionID: "ABCD00123456789", + AccessionID: "", DecryptedChecksums: []Checksums{ {Type: "sha256", Value: "da886a89637d125ef9f15f6d676357f3a9e5e10306929f0bad246375af89c2e2"}, + {Type: "md5", Value: "68b329da9893e34099c7d8ad5cb9c940"}, }, } diff --git a/sda/schemas/isolated/dataset-deprecate.json b/sda/schemas/isolated/dataset-deprecate.json index 0e09965a1..d279a8195 100644 --- a/sda/schemas/isolated/dataset-deprecate.json +++ b/sda/schemas/isolated/dataset-deprecate.json @@ -21,6 +21,7 @@ "type": "string", "title": "The Accession identifier for the dataset", "description": "The Accession identifier for the dataset", + "minLength": 2, "examples": [ "anyidentifier" ] diff --git a/sda/schemas/isolated/dataset-mapping.json b/sda/schemas/isolated/dataset-mapping.json index 28f736d72..543f61d86 100644 --- a/sda/schemas/isolated/dataset-mapping.json +++ b/sda/schemas/isolated/dataset-mapping.json @@ -22,6 +22,7 @@ "type": "string", "title": "The Accession identifier for the dataset", "description": "The Accession identifier for the dataset", + "minLength": 2, "pattern": "^\\S+$", "examples": [ "anyidentifier" diff --git a/sda/schemas/isolated/ingestion-accession.json b/sda/schemas/isolated/ingestion-accession.json index 4b3cdfe16..fddd94622 100644 --- a/sda/schemas/isolated/ingestion-accession.json +++ b/sda/schemas/isolated/ingestion-accession.json @@ -116,6 +116,7 @@ "type": "string", "title": "The Accession identifier", "description": "The Accession identifier", + "minLength": 2, "pattern": "^\\S+$", "examples": [ "anyidentifier"