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

Review/modify: jsonPrinter for datasetFieldType #10472

Open
sekmiller opened this issue Apr 9, 2024 · 2 comments · May be fixed by #11066
Open

Review/modify: jsonPrinter for datasetFieldType #10472

sekmiller opened this issue Apr 9, 2024 · 2 comments · May be fixed by #11066
Labels
Feature: API Feature: Metadata FY25 Sprint 11 FY25 Sprint 11 (2024-11-20 - 2024-12-04) FY25 Sprint 12 FY25 Sprint 12 (2024-12-04 - 2024-12-18) Size: 10 A percentage of a sprint. 7 hours. Type: Bug a defect

Comments

@sekmiller
Copy link
Contributor

Overview of the Feature Request

As written the jsonPrinter for datasetFieldType adds subfields whenever !fld.getChildDatasetFieldTypes().isEmpty() calling the printer recursively. The jsonPrinter for metadatabocks calls the jsonPrinter for datasetfieldtype for all so the subfields appear twice - once as a subfield and once as a stand alone field. It's a little confusing to see these fields twice. A possible solution would be to filter out those subfields where isChild is true - That would work for our current dataset field types but would fail if we ever implement subfields of subfields. We also have to be careful not to disrupt the current users of the getMetadataBlock api endpoint.
The SPA team has noticed the issue and is working around it for CreateDataset see #10418

What kind of user is the feature intended for?
(Example users roles: API User)

What inspired the request?
Work on the PR noted above

What existing behavior do you want changed?
Possibly changing the getMetadataBlock api to only show each datasetFieldType once

Any brand new behavior do you want to add to Dataverse?

Any open or closed issues related to this feature request?

@sekmiller sekmiller added the Type: Feature a feature request label Apr 9, 2024
@sbarbosadataverse sbarbosadataverse moved this to SPRINT- NEEDS SIZING in IQSS Dataverse Project Jun 26, 2024
@sekmiller sekmiller added the Size: 10 A percentage of a sprint. 7 hours. label Nov 21, 2024
@sekmiller sekmiller moved this from SPRINT- NEEDS SIZING to SPRINT READY in IQSS Dataverse Project Nov 21, 2024
@cmbz cmbz added the FY25 Sprint 11 FY25 Sprint 11 (2024-11-20 - 2024-12-04) label Nov 22, 2024
@stevenwinship stevenwinship self-assigned this Dec 4, 2024
@stevenwinship stevenwinship moved this from This Sprint 🏃‍♀️ 🏃 to In Progress 💻 in IQSS Dataverse Project Dec 4, 2024
@stevenwinship
Copy link
Contributor

Just to clarify, the objects under "fields" stay and the duplicate objects under "childFields" get suppressed?
In the example below, subType4 and subType5 under subType3 can be removed from subType3's child list since they are listed in "fields" as separate stand alone objects?

json: {
    "id": 0,
    "name": "citation",
    "displayOnCreate": false,
    "fields": {
        "subType1": {
            "name": "subType1",
            "displayOnCreate": false,
            "type": "TEXT",
            "typeClass": "primitive",
            "multiple": false,
            "isControlledVocabulary": false,
            "displayOrder": 0,
            "isRequired": false
        },
        "subType2": {
            "name": "subType2",
            "displayOnCreate": false,
            "type": "TEXT",
            "typeClass": "primitive",
            "multiple": false,
            "isControlledVocabulary": false,
            "displayOrder": 1,
            "isRequired": false
        },
        "subType3": {
            "name": "subType3",
            "displayOnCreate": false,
            "type": "TEXT",
            "typeClass": "compound",
            "multiple": false,
            "isControlledVocabulary": false,
            "displayOrder": 2,
            "isRequired": false,
            "childFields": {
                "subType4": {
                    "name": "subType4",
                    "displayOnCreate": false,
                    "type": "TEXT",
                    "typeClass": "primitive",
                    "multiple": false,
                    "isControlledVocabulary": false,
                    "displayOrder": 3,
                    "isRequired": false
                },
                "subType5": {
                    "name": "subType5",
                    "displayOnCreate": false,
                    "type": "TEXT",
                    "typeClass": "primitive",
                    "multiple": false,
                    "isControlledVocabulary": false,
                    "displayOrder": 4,
                    "isRequired": false
                }
            }
        },
        "subType4": {
            "name": "subType4",
            "displayOnCreate": false,
            "type": "TEXT",
            "typeClass": "primitive",
            "multiple": false,
            "isControlledVocabulary": false,
            "displayOrder": 3,
            "isRequired": false
        },
        "subType5": {
            "name": "subType5",
            "displayOnCreate": false,
            "type": "TEXT",
            "typeClass": "primitive",
            "multiple": false,
            "isControlledVocabulary": false,
            "displayOrder": 4,
            "isRequired": false
        }
    }
}

@cmbz cmbz added the FY25 Sprint 12 FY25 Sprint 12 (2024-12-04 - 2024-12-18) label Dec 5, 2024
@sekmiller
Copy link
Contributor Author

@stevenwinship I think the opposite - if they are child fields we don't want to show them as stand-alone fields so we would include subtypes 4 and 5 only as children of subtype 3. Maybe we could bring it up in the front end meeting to see if there is a preferred method for the SPA.

@stevenwinship stevenwinship linked a pull request Dec 5, 2024 that will close this issue
@stevenwinship stevenwinship removed their assignment Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: API Feature: Metadata FY25 Sprint 11 FY25 Sprint 11 (2024-11-20 - 2024-12-04) FY25 Sprint 12 FY25 Sprint 12 (2024-12-04 - 2024-12-18) Size: 10 A percentage of a sprint. 7 hours. Type: Bug a defect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants