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

Fix Red Squiggles For Ralph #677

Merged
merged 4 commits into from
Oct 2, 2019
Merged

Conversation

carolynvs
Copy link
Member

@carolynvs carolynvs commented Oct 1, 2019

What does this change

The test for porter's schema was only checking that the schema was valid.
It wasn't checking that the porter.yaml validated against the schema... sad trombone

This fixes the test so that it fails when the schema drifts and prints all the problems with the schema.

  • Add applyTo to parameters
  • Use additionalProperties instead of patternProperties. PatternProperties validation is applied on top of properties, which isn't what we wanted. AdditionalProperties validation applies to properties not defined already in Properties.
  • Use arrays instead of objects for credentials, parameters and outputs
  • Remove destination nesting around env and path for parameter
  • Remove explicit default for booleans when the value is false. Otherwise VS Code inserts those properties during autocomplete.

This requires a sweep of all our mixins because of the change from patternProperties to additionalProperties so that mixins also fix the double validation problem.

What issue does it fix

Closes #662

Notes for the reviewer

  • Whenever the schema specifies a default value for a field, then when its autocompleted, then that field is always inserted with its default. e.g. if I type if - kubTAB, I'm going to get every single field that has a default inserted, even though those fields aren't necessary because those defaults are added at runtime by the mixin itself. We may want to stop adding defaults to the schema, so that that they aren't auto-inserted if that wasn't our intent.

Checklist

  • Unit Tests
  • Documentation
    • Documentation Not Impacted

The test for porter's schema was only checking that the schema was valid.
It wasn't checking that the porter.yaml validated against the schema... **sad trombone**

This fixes the test so that it fails when the schema drifts.
* Use additionalProperties instead of patternProperties
* Arrays instead of objects for credentials, parameters and outputs
* definition isn't actually required, porter will default it for you
* Remove destination nesting around env and path for parameter

This requires a sweep on the mixins because of the change from
patternProperties to additionalProperties. But it is finally doing
things properly so that's a thing.
@carolynvs carolynvs force-pushed the fix-squiggles branch 2 times, most recently from ff393bb to 40aba2e Compare October 2, 2019 14:47
* Add applyTo to parameters
* Remove explicit default for booleans when the value is false.
Otherwise VS Code inserts those properties during autocomplete.
@carolynvs carolynvs marked this pull request as ready for review October 2, 2019 17:05
Copy link
Contributor

@jeremyrickard jeremyrickard left a comment

Choose a reason for hiding this comment

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

LGTM. Love JSON Schema!

@jeremyrickard jeremyrickard merged commit f383c64 into getporter:master Oct 2, 2019
@carolynvs carolynvs deleted the fix-squiggles branch April 3, 2020 15:20
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

Successfully merging this pull request may close these issues.

Porter Schema exporting needs updating
3 participants