Skip to content

Addition of AllowedDatasetTypes to Collection#441

Open
jp-tosca wants to merge 8 commits intodevelopfrom
add_metadata_block
Open

Addition of AllowedDatasetTypes to Collection#441
jp-tosca wants to merge 8 commits intodevelopfrom
add_metadata_block

Conversation

@jp-tosca
Copy link
Copy Markdown
Contributor

@jp-tosca jp-tosca commented Apr 22, 2026

What this PR does / why we need it:

  • Collections can determine what type of datasets are allowed on them. This PR modifies Collection to display what allowed DatasetTypes can be created with the field allowedDatasetTypes.

Which issue(s) this PR closes:

This PR doesn't have a hard dependency, but merging #440 would make it easier to test.

Suggestions on how to test this:

Having a running dataverse installation and create a collection named REVIEW, then run the following script to configure it (Replace your api token):

API_TOKEN="XXXXXXXXXXXXXXXXXX"    

COLLECTION_NAME="REVIEW"
DS_TYPES="review"
#DS_TYPES="dataset"
#DS_TYPES="dataset,review"

URL="https://raw.githubusercontent.com/IQSS/dataverse/master/scripts/api/data/metadatablocks/review.tsv"
OUTPUT_FILE="review.tsv"

TYPE_URL="https://dataverse-guide--11753.org.readthedocs.build/en/11753/_downloads/c2a076bba578dc93b3582f41d6fba594/review.json"
TYPE_OUTPUT_FILE="review.json"

curl -fL "$URL" -o "$OUTPUT_FILE"
curl -fL "$TYPE_URL" -o "$TYPE_OUTPUT_FILE"


UPLOAD_METADATA="http://localhost:8080/api/admin/datasetfield/load"

curl "$UPLOAD_METADATA" -H "Content-type: text/tab-separated-values" -X POST --upload-file "$OUTPUT_FILE"

echo "Uploaded metadata to $UPLOAD_METADATA"

UPDATE_SOLR="http://localhost:8080/api/admin/index/solr/schema"
curl "$UPDATE_SOLR"

curl -H "X-Dataverse-key:$API_TOKEN" -H "Content-Type: application/json" "http://localhost:8080/api/datasets/datasetTypes" -X POST --upload-file review.json
curl -X PUT -H "X-Dataverse-key:$API_TOKEN" "http://localhost:8080/api/dataverses/$COLLECTION_NAME/attribute/allowedDatasetTypes?value=$DS_TYPES"

curl http://localhost:8080/api/admin/index/solr/schema | docker run -i --rm -v ./dev-env/docker-dev-volumes/solr/data:/var/solr gdcc/configbaker:unstable update-fields.sh /var/solr/data/collection1/conf/schema.xml

Once this is done, use JS Dataverse to retrieve this collection.

Copilot AI review requested due to automatic review settings April 22, 2026 20:29
@github-actions github-actions Bot added FY26 Sprint 18 FY26 Sprint 18 (2026-02-25 - 2026-03-11) FY26 Sprint 20 FY26 Sprint 20 (2026-03-26 - 2026-04-08) FY26 Sprint 21 FY26 Sprint 21 (2026-04-08 - 2026-04-22) FY26 Sprint 22 FY26 Sprint 22 (2026-04-22 - 2026-05-06) GREI Re-arch GREI re-architecture-related Project: Trusted Data labels Apr 22, 2026
@jp-tosca jp-tosca moved this to In Progress 💻 in IQSS Dataverse Project Apr 22, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for returning a collection’s allowed dataset types as part of the Collection model, so clients (e.g., Create Dataset UI) can display which dataset types can be created in a collection.

Changes:

  • Extended Collection and CollectionPayload to include allowedDatasetTypes.
  • Updated collection payload transformer to map allowedDatasetTypes into domain DatasetType[].
  • Updated collection test helpers’ fixtures to include allowedDatasetTypes.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
test/testHelpers/collections/collectionHelper.ts Updates mock Collection model/payload fixtures to include allowedDatasetTypes for unit tests.
src/collections/infra/repositories/transformers/collectionTransformers.ts Transforms allowedDatasetTypes from API payload into domain DatasetType[].
src/collections/infra/repositories/transformers/CollectionPayload.ts Adds allowedDatasetTypes to the Collection API payload typing and defines AllowedDatasetTypePayload.
src/collections/domain/models/Collection.ts Adds allowedDatasetTypes?: DatasetType[] to the Collection domain model.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/collections/domain/models/Collection.ts
@jp-tosca jp-tosca moved this from In Progress 💻 to Ready for Review ⏩ in IQSS Dataverse Project Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FY26 Sprint 18 FY26 Sprint 18 (2026-02-25 - 2026-03-11) FY26 Sprint 20 FY26 Sprint 20 (2026-03-26 - 2026-04-08) FY26 Sprint 21 FY26 Sprint 21 (2026-04-08 - 2026-04-22) FY26 Sprint 22 FY26 Sprint 22 (2026-04-22 - 2026-05-06) GREI Re-arch GREI re-architecture-related Project: Trusted Data

Projects

Status: Ready for Review ⏩

Development

Successfully merging this pull request may close these issues.

Update Get Collection use case to include available dataset types

2 participants