Skip to content

Coerce configuration input#8319

Merged
medikoo merged 5 commits into
masterfrom
1001-coerce-schema
Oct 1, 2020
Merged

Coerce configuration input#8319
medikoo merged 5 commits into
masterfrom
1001-coerce-schema

Conversation

@medikoo

@medikoo medikoo commented Oct 1, 2020

Copy link
Copy Markdown
Contributor

So far version validation was strict, we've just allowed null values (properties with null were removed for validation), still that imposes not justified burden (as e.g. case described here: #8285 (comment))

This patch ensures that null valued properties are cleared from resolved config not only for validation but also for it's further processing, and more importantly it coerces primitive values so they adhere to schema.

Coercion is done per rules described here: https://ajv.js.org/coercion.html (with array coercion turned off at this point, as it seems it be problematic: ajv-validator/ajv#1294)

@codecov-commenter

codecov-commenter commented Oct 1, 2020

Copy link
Copy Markdown

Codecov Report

Merging #8319 into master will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8319      +/-   ##
==========================================
- Coverage   88.02%   88.02%   -0.01%     
==========================================
  Files         249      249              
  Lines        9312     9308       -4     
==========================================
- Hits         8197     8193       -4     
  Misses       1115     1115              
Impacted Files Coverage Δ
lib/configSchema.js 100.00% <ø> (ø)
...lugins/aws/package/compile/events/httpApi/index.js 92.59% <ø> (ø)
lib/plugins/aws/provider/awsProvider.js 93.04% <ø> (ø)
lib/classes/ConfigSchemaHandler/index.js 89.10% <100.00%> (-0.42%) ⬇️
...ib/plugins/aws/package/compile/events/alb/index.js 100.00% <100.00%> (ø)
...ins/aws/package/compile/events/cloudFront/index.js 99.32% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 38c2047...52074bd. Read the comment docs.

@medikoo
medikoo merged commit a6ff964 into master Oct 1, 2020
@medikoo
medikoo deleted the 1001-coerce-schema branch October 1, 2020 13:31
medikoo added a commit that referenced this pull request Oct 8, 2020
They were removed by mistake with #8319.
It's only primitive/array combinations where singular variant should be removed. object/array should be left intact
medikoo added a commit that referenced this pull request Oct 8, 2020
They were removed by mistake with #8319.
It's only primitive/array combinations where singular variant should be removed. object/array should be left intact
medikoo added a commit that referenced this pull request Oct 8, 2020
They were removed by mistake with #8319.
It's only primitive/array combinations where singular variant should be removed. object/array should be left intact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants