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

Some Odd Behavior regarding conditional properties #32

Open
ThePieBandit opened this issue Dec 21, 2020 · 0 comments
Open

Some Odd Behavior regarding conditional properties #32

ThePieBandit opened this issue Dec 21, 2020 · 0 comments

Comments

@ThePieBandit
Copy link

Given my setup here, I'm seeing a gap. Specifically:

  1. Add a Unit
  2. Add a Special
  3. Add an Effect
  4. Select damage as the Effect Type.

the JSON Schema for effect is

            "type": "object",
            "additionalProperties": { "type": "string" },
            "properties": {
                "attributes": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/Attribute"
                    }
                },
                "chance": {
                    "type": "integer"
                },
                "duration": {
                    "type": "integer"
                },
                "effect": {
                    "$ref": "#/definitions/EffectEnum"
                },
                "targeting": {
                    "$ref": "#/definitions/Targeting"
                },
                "amount": {
                    "type": "number"
                },
                "level": {
                    "type": "integer"
                },
                "range": {
                    "$ref": "#/definitions/Range"
                },
                "condition": {
                    "$ref": "#/definitions/Condition"
                }
            },
            "allOf": [
                {
                    "if": {
                        "properties": { "effect": { "const": "damage" } }
                    },
                    "then": {
                        "properties": {
                            "type": {
                                "$ref": "#/definitions/AttackEffectType"
                            }
                        }
                    }
                },
                {
                    "if": {
                        "properties": { "effect": { "const": "recharge" } }
                    },
                    "then": {
                        "properties": {
                            "type": {
                                "$ref": "#/definitions/RechargeEffectType"
                            }
                        }
                    }
                }
            ],
            "required": [
                "effect",
                "targeting"
            ],
            "title": "Effect"
        },

Note that type is expected under two of the enum values, but with a different schema for each. Is this something that can be supported?

Additionally, this schema has been edited slightly from the one I am using for the online editor. the two items that have a maxItems, also have a minItems of the same amount. While this works correctly in the editor, it makes the copy button non-functional. If possible, could the copy button overwrite the subsequent entry in the array with its values so the array can be copied?

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

1 participant