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

JSON pointer to elements in arrays of non-fixed length #1079

Open
unext-wendong opened this issue Jun 27, 2024 · 3 comments
Open

JSON pointer to elements in arrays of non-fixed length #1079

unext-wendong opened this issue Jun 27, 2024 · 3 comments

Comments

@unext-wendong
Copy link

unext-wendong commented Jun 27, 2024

Kindly let me know if this is the wrong place to ask this question.

Given the following sample schema, property Services is an array of non-fixed length.

{
    "definitions": {
        "Service": {
            "properties": {
                "Id": {
                    "description": "The ID of the service instance.",
                    "type": "string"
                }
            },
            "additionalProperties": false
        }
    },
    "properties": {
        "Id": {
            "description": "Unique identifier.",
            "type": "string"
        },
        "Services": {
            "description": "The list of services.",
            "type": "array",
            "items": {
                "$ref": "#/definitions/Service"
            }
        }
    },
    "additionalProperties": false,
    "readOnlyProperties": [
        "/properties/Id"
    ],
    "primaryIdentifier": [
        "/properties/Id"
    ],
    "writeOnlyProperties": [
        "/properties/Services/0/Id"
    ]
}

How could I express in the schema that the Id property in the Service data is write-only?
I mean what json pointers should I put in writeOnlyProperties.

If the Services array is of fixed length, I could list all /properties/Services/0/Id, /properties/Services/1/Id, ..., there, but it's of non-fixed length.

If it's not possible, is there any other way to express this?

Thanks,

@kddejong
Copy link
Contributor

Couple of options for you to try. If everything under Services is write only "/properties/Services/*" or if its just the id "/properties/Services/*/Id"

@unext-wendong
Copy link
Author

With *, I got error:

E   ValueError: invalid literal for int() with base 10: '*'

Seems to be an invalid syntax.

I'm using the cloudformation-cli-python-plugin==2.1.9.

@kddejong
Copy link
Contributor

@ammokhov I have that right don't I? Is this an issue with the python plugin?

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

No branches or pull requests

2 participants