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

Render in arguments section optional computed properties with default values #290

Merged
merged 2 commits into from
Apr 7, 2021

Conversation

dikhan
Copy link
Owner

@dikhan dikhan commented Apr 7, 2021

What problem does this Pull Request solve?

terraformdocsgenerator does not render optional computed properties with default values in the arguments section

  • Added helper method IsOptionalComputedWithDefault to check within the renderer
    whether the property with default value is to be treated as optional computed too.
  • Renderer now includes both optioanl computed properties and optioanl computed properties
    with default values in the arguments section along with the default value if populated.
  • Other tests were failing due to ordering not matching anymore. This is due to
    the hashstructure.Hash now computing the new property added which changed the hash order.

Please link to the issue number here (issue will be closed when PR is merged): Closes #289

Type of change

What type of change does your code introduce to the provider? Please put an x (w/o heading/trailing white spaces) in the boxes that apply:

  • New feature (change that adds new functionality)
  • Bug-fix (change that fixes current functionality)
  • Tech debt (enhances the current functionality)
  • New release (pumps the version)

Checklist

Please put an x (w/o heading/trailing white spaces) in the boxes that apply:

  • I have read and followed the CONTRIBUTING guidelines
  • I have added tests that prove my fix is effective or that my feature works
  • I have made sure code compiles correctly and all tests are passing by running make test-all
  • I have added/updated necessary documentation (if appropriate)
  • I have added the following info to the title of the PR (pick the appropriate option for the type of change). This is important because the release notes will include this information.
    • Feature Request: PRs related to feature requests should have in the title [FeatureRequest: Issue #X] <PR Title>
    • Bug Fixes: PRs related to bug fixes should have in the title [BugFix: Issue #X] <PR Title>
    • Tech Debt: PRs related to technical debt should have in the title [TechDebt: Issue #X] <PR Title>
    • New Release: PRs related to a new release should have in the title [NewRelease] vX.Y.Z

Checklist for Admins

  • Label is populated
  • PR is assigned to the corresponding project
  • PR has at least 1 reviewer and 1 assignee

… values

- Added helper method IsOptionalComputedWithDefault to check within the renderer
whether the property with default value is to be treated as optional computed too.
- Renderer now includes both optioanl computed properties and optioanl computed properties
with default values in the arguments section along with the default value if populated.
- Other tests were failing due to ordering not matching anymore. This is due to
the hashstructure.Hash now computing the new property added which changed the hash order.
@dikhan dikhan added the bug-fix label Apr 7, 2021
@dikhan dikhan requested a review from jzafran April 7, 2021 18:55
@dikhan dikhan added this to Backlog in API Terraform Provider (OpenAPI 2.0) via automation Apr 7, 2021
@dikhan dikhan self-assigned this Apr 7, 2021
@codecov
Copy link

codecov bot commented Apr 7, 2021

Codecov Report

Merging #290 (5d2c8e9) into master (dac381f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #290   +/-   ##
=======================================
  Coverage   92.13%   92.14%           
=======================================
  Files          60       60           
  Lines        3066     3069    +3     
=======================================
+ Hits         2825     2828    +3     
  Misses        163      163           
  Partials       78       78           
Impacted Files Coverage Δ
...penapi_spec_resource_schema_definition_property.go 100.00% <100.00%> (ø)
...erator/openapi_terraform_provider_doc_generator.go 100.00% <100.00%> (ø)
...api_terraform_provider_documentation_properties.go 100.00% <100.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 dac381f...5d2c8e9. Read the comment docs.

jzafran
jzafran previously approved these changes Apr 7, 2021
API Terraform Provider (OpenAPI 2.0) automation moved this from Backlog to In progress Apr 7, 2021
- Previously depending on the value of Default if it happend to be a bool with value
false or an array with empty value the if statement would not process the Default render
section due to the if statement returning false
@dikhan dikhan merged commit e7a9fb6 into master Apr 7, 2021
API Terraform Provider (OpenAPI 2.0) automation moved this from In progress to Done Apr 7, 2021
@dikhan dikhan deleted the render-default-values branch April 7, 2021 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 participants