Model inputs schema validated on all methods — delete fails requiring create-time inputs
Opened by swampadmin · 6/6/2025
Bug Description
When running a method on a model that has an inputs schema, swamp validates the provided inputs against the model's inputs.required fields regardless of which method is being called. This means a delete method (which only needs an id argument) fails because the model's create-time required inputs aren't provided.
Steps to Reproduce
- Define a model with required inputs for creation:
inputs:
properties:
dropletName:
type: string
region:
type: string
tagName:
type: string
vpcName:
type: string
required:
- dropletName
- region
- tagName
- vpcName
methods:
create:
arguments: {}
delete:
arguments:
id: "some-id"- Run the delete method providing only what delete needs:
swamp model method run web-droplet delete --json- Fails with:
Input validation failed: dropletName is required
Expected Behavior
Method-specific argument validation only. The delete method's argument schema requires id — that should be the only validation. The model-level inputs schema (dropletName, region, etc.) is irrelevant for delete operations.
Actual Behavior
The model-level inputs.required fields are validated before any method execution, regardless of which method is called. This means:
- You cannot delete a resource without providing all create-time inputs
- You cannot run
getwithout providing all create-time inputs - Every method call requires the full model input set, even when the method doesn't use any of them
Impact
This makes teardown operations unnecessarily complex. To delete a droplet, the user must provide dropletName, region, tagName, and vpcName — none of which the delete method uses. In a parameterized multi-environment setup, this means the user must remember and provide all the original creation parameters just to delete a resource.
Summary
The fix would involve scoping input validation to be method-aware. The model-level inputs schema should either:
- Only validate when the method's arguments reference
inputs.*expressions - Support per-method input requirements
- Skip
inputs.requiredvalidation for methods that don't reference any input fields in their arguments
Closed
No activity in this phase yet.
Sign in to post a ripple.