mulesoftapi-gatewayanypoint-platformcustom-code

Custom policy does not maintain previous values on properties array


I am creating a custom policy following this documentation.

I created one, and it is working. The JSON schema for the policy is shown below:

{
    "title": "ACME Custom Basic Auth Policy",
    "description": "Basic Authentication policy which enforces security according with custom consumer credentials",
    "type": "object",
    "properties": {
        "users": {
            "title": "users",
            "type": "array",
            "items": {
                "type": "object",
                "required": [
                    "username",
                    "password"
                ],
                "properties": {
                    "username": {
                        "title": "User Name",
                        "type": "string",
                        "default": []
                    },
                    "password": {
                        "title": "User Password",
                        "type": "string",
                        "@context": {
                            "@characteristics": [
                                "security:sensitive"
                            ]
                        }
                    }
                }
            },
            "minItems": 1
        }
    },
    "@context": {
        "@vocab": "anypoint://vocabulary/policy.yaml#",
        "security": "anypoint://vocabulary/policy.yaml#"
    },
    "$id": "allow-dynamic-resources",
    "$schema": "https://json-schema.org/draft/2019-09/schema"
}

When I go to API Manager, I can configure the values on first attempt, but when I go back to change the values, they do not appear.

enter image description here

This happens only when I configure an array. If I configure as an object, it works. How can I fix this?

enter image description here


Solution

  • I opened a support ticket for MuleSoft and they explained when a field is declared with

    "@characteristics": [
        "security:sensitive"
    ]
    

    the values are not prompted when reediting policy.