juju / charm

Parsing and testing Juju charms
Other
13 stars 59 forks source link

Disallow unknow action parameters #424

Closed Aflynn50 closed 7 months ago

Aflynn50 commented 7 months ago

Add a new default option additionalProperties: false to the json schema that is used when parsing actions. This option causes an error to be thrown by ValidateParams when the user passes a parameter that is not mentioned in the action description.

This is a breaking change!!

To allow backwards compatibility or use actions in a prior way, use additionalProperties: true.

echo:
  description: Provide an echo action.
  additionalProperties: true
  params:
    value:
      type: string
      description: The value that should be echo'd
Aflynn50 commented 7 months ago

Removed the version bump @SimonRichardson

Aflynn50 commented 7 months ago

@Aflynn50 we just need a test where you have additionalProperties: true and it allows additional properties (we might already have one, just double-check). This should bake in this feature.

Good point, added

Aflynn50 commented 7 months ago

/merge