Skip to content

Lexicon expects data within an inner object with $bytes property#15

Open
germ-mark wants to merge 4 commits intomainfrom
mark/GER-1437
Open

Lexicon expects data within an inner object with $bytes property#15
germ-mark wants to merge 4 commits intomainfrom
mark/GER-1437

Conversation

@germ-mark
Copy link
Contributor

No description provided.

@germ-mark
Copy link
Contributor Author

preemptively tagged this 1.1.11 for downstream while we review this

Copy link
Collaborator

@ThisIsMissEm ThisIsMissEm left a comment

Choose a reason for hiding this comment

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

Looks fine to me at a high level, just a few smaller comments.

keyedBy: LexiconBytes.CodingKeys.self
)
self.bytes = try container.decode(Data.self, forKey: .bytes)
} catch {
Copy link
Collaborator

Choose a reason for hiding this comment

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

should this be catching a specific error here? i.e., I think this would catch both if the container doesn't exist or if the decoding failed, but I think we want to only fall through if the container doesn't exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea... I think that needs us to move the decode out of the do closure


let lexiconBytes = currentKey as! [String: Any]

let base64 = lexiconBytes["$bytes"] as! String
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there meant to be another assertion here?

let base64 = lexiconBytes["$bytes"] as! String
}

@Test func testValidCycle() throws {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure what this test case and the next are really testing, given they don't have any assertions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that decode doesn't throw. a more extensive test is appropriate, certainly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there's a bunch of pointy (!) and less pointy (try) edges here that were part of turning this around Monday night on short notice.

Will go through and make this a proper test that reports how it fails instead of just failing.

self.bytes = try container.decode(Data.self, forKey: .bytes)
} catch {
let container = try decoder.singleValueContainer()
self.bytes = try container.decode(Data.self)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You may want to set a flag here: "needs upgrade" — though we can infer this from the version on the declaration record.

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.

2 participants

Comments