-
-
Notifications
You must be signed in to change notification settings - Fork 143
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 for inline empty Dictionary: Bitbucket Cloud #280
Conversation
Sources/Danger/BitBucketCloud.swift
Outdated
self.deleted = try container.decode(Bool.self, forKey: .deleted) | ||
self.id = try container.decode(Int.self, forKey: .id) | ||
// protect from "inline": {} | ||
self.inline = (try? container.decodeIfPresent(Inline.self, forKey: .inline)) ?? nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just make path
optional too, and that prevents from "inline": {}
as well, but also from all the combinations that you can have (only path, only from etc).
If, on the other hand, it either have only zero or all the variables, I would then make them all required, and keep this line, what are your thoughts about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clearly from the json I printed out.. to
was set to null. so I don't think you can make them all required.
Decoding JSON is like a losing battle if you don't control it ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be ok I guess with having everything in inline
be optional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah looks a good option :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok.. so we rather just make all of the fields in inline optional vs the init right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR, just one small comment :)
Remember also to update the changelog with the change, the link to this PR and to your account :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
This fixes the issue where the json payload for the Comment can have inline as an empty dictionary:
vs