fix(pipeline_config): fix model template bool property #33
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes the boolean type definition of all models by transforming them into a pointer boolean. For now, I have only pushed one of the problematic models.
Underlying issue
Whenever a boolean value is
false
and it is not required, theomitempty
serialization property will omit this property. In cases where an entity needs to be disabled through afalse
status, this is not the desired result. Instead, we always want to sendtrue/false
value, but omit when it is not explicitly set. Through a pointer, when the value is not defined, it will be set tonil
and only then will be omitted from the API call.Upstream
The issue is related to the generator used, and a very old issue is open for this: swagger-api/swagger-codegen#7391
I have sent an upstream Pull Request: swagger-api/swagger-codegen-generators#1275
As I do not expect this Pull Request to be merged any time soon (there has not been a Go update in 4 years), I added the same patch in this repo as a custom template. This template can be removed once upstream has been merged.
Related to DrFaust92/terraform-provider-bitbucket#191, and some other mentioned issues.
Once this has been merged, I will go through the related issues and add regression tests where it is needed.