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

Schema validator doesn't resolve default values for nested defs #370

Open
MayberryZoom opened this issue Oct 20, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@MayberryZoom
Copy link
Contributor

Working on #369 I encountered this issue trying to write schema for actor layers:

"actor_reference_with_layer": {
    "type": "object",
    "properties": {
        "scenario": {
            "$ref": "#/$defs/scenario_name"
        },
        "actor_layer": {
            "$ref": "#/$defs/actor_layer"
        },
        "sublayer": {
            "type": "string"
        },
        "layer": {
            "type": "string",
            "default": "default",
            "deprecated": true
        },
        "actor": {
            "type": "string"
        }
    },
    "required": [
        "scenario",
        "actor"
    ]
},
"actor_layer": {
    "type": "string",
    "enum": [
        "rEntitiesLayer",
        "rSoundsLayer",
        "rLightsLayer"
    ],
    "default": "rEntitiesLayer"
},

This defaulted layer as expected, but actor_layer ended up receiving no value (tested with actor patcher):

{
    "actor": {
        "scenario": "s020_magma",
        "actor": "trap_thermal_horizontal_004"
    },
    "new_reference": {
        "scenario": "s020_magma",
        "actor": "trap_thermal_horizontal_custom_000"
    },
    "modifications": [
        {
            "path": ["vAng", 2],
            "update_to": 3.14159
        }
    ],
    "make_copy": true
}
original_reference = {'actor': 'trap_thermal_horizontal_004', 'layer': 'default', 'scenario': 's020_magma'}
new_reference = {'actor': 'trap_thermal_horizontal_custom_000', 'layer': 'default', 'scenario': 's020_magma'}
modifications = [{'path': ['vAng', 2], 'update_to': 3.14159}], actor_groups = []
make_copy = True

Copy pasting the actor_layer definition into where it was being referenced will default as expected, leading me to believe this has to be caused by nested defs.

@MayberryZoom MayberryZoom added the bug Something isn't working label Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant