Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

fix: Switch from ARM Template params to JSON Schema params #660

Conversation

technosophos
Copy link
Member

Switch to JSON Schema's keywords for validators, add pattern validator and exclusive[Min|Max] validators.

Also, refactored the tests to (a) increase coverage, and (b) reduce boilerplate.

Closes #648

@technosophos technosophos self-assigned this Mar 6, 2019
@ghost ghost added the review label Mar 6, 2019
Copy link
Member

@radu-matei radu-matei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with the only comment about returning a float when coercing for an integer.

@technosophos technosophos force-pushed the fix/648-update-param-validators branch from c8a550a to 6c98a65 Compare March 11, 2019 22:18
@technosophos
Copy link
Member Author

Updated with a pointer to the explanation here.

@itowlson
Copy link
Contributor

Note that this is going to be a breaking change for downstream tooling, which parses the bundle's parameters section in order to interactively validate input values.

@technosophos
Copy link
Member Author

Oh! Good catch @itowlson !

@radu-matei radu-matei force-pushed the fix/648-update-param-validators branch from 6c98a65 to 7d8b81f Compare April 3, 2019 17:16
@ghost ghost assigned radu-matei Apr 3, 2019
@radu-matei radu-matei requested review from michelleN and removed request for michelleN April 3, 2019 17:18
@radu-matei
Copy link
Member

As this also touches on ApplyTo for parameters, can you please take a look, @silvin-lubecki?

Thanks!

MaxLength *int `json:"maxLength,omitempty" mapstructure:"maxLength,omitempty"`
Pattern string `json:"pattern,omitempty" mapstructure:"pattern,omitempty"`
Enum []interface{} `json:"enum,omitempty" mapstructure:"enum,omitempty"`
Metadata ParameterMetadata `json:"metadata,omitempty" mapstructure:"metadata,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should Metadata be Description?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the parameter definition from the spec:

  • metadata: Holds fields that are not used in validation (OPTIONAL)
    • description: A user-friendly description of the parameter

And it's the same here.

@technosophos
Copy link
Member Author

This is outdated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change parameters to use the JSON Schema format instead of the ARM format
4 participants