Skip to content

Guard against element type mismatch at document type creation #18529

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

Merged
merged 1 commit into from
Mar 4, 2025

Conversation

kjac
Copy link
Contributor

@kjac kjac commented Mar 3, 2025

Prerequisites

  • I have added steps to test this contribution in the description below

Description

#16421 introduced guards against (and warnings for) element type mismatch for document types. Unfortunately, while the PR actually added guards at document type creation time, these guards were never actually applied 😢

This PR fixes it.

Testing this PR

You'll need to use Swagger UI to test this, as the backoffice client UI doesn't support creating inherited document types yet.

  1. Create a document type.
  2. Using Swagger UI, attempt to create a child element type to the document type.
  3. Verify that this fails with a "mismatched" error status.

Now do the same, but with a parent element type and a child document type. The result should be the same.

You can use the following payload when testing with with Swagger UI. Remember to:

  • Replace the parent document type key.
  • Add your preferred document/element type alias (remember, no duplicates when testing).
  • Set isElement according to the test case you're executing.
{
    "allowedTemplates": [],
    "defaultTemplate": null,
    "cleanup": {
        "preventCleanup": false,
        "keepAllVersionsNewerThanDays": null,
        "keepLatestVersionPerDayForDays": null
    },
    "allowedDocumentTypes": [],
    "compositions": [{
            "documentType": {
                "id": "[insert parent document type key here]"
            },
            "compositionType": "Inheritance"
        }
    ],
    "alias": "[replace me]",
    "name": "Inherit Test",
    "description": null,
    "icon": "icon-bug color-red",
    "allowedAsRoot": false,
    "variesByCulture": false,
    "variesBySegment": false,
    "collection": null,
    "isElement": [true/false],
    "properties": [],
    "containers": []
}

@Migaroez Migaroez merged commit 67ed38f into v15/dev Mar 4, 2025
22 checks passed
@Migaroez Migaroez deleted the v15/fix/guard-against-element-type-mismatch branch March 4, 2025 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants