Skip to content

Replace dynamic type checks with generic overloads #41

Closed
@simonjbeaumont

Description

@simonjbeaumont

A recent PR to the runtime library was fixing an issue for the transcoding of types that have an additional protocol conformance. This was done with a dynamic as? type check and an as! force cast.

In a comment, we discussed a better way: using a specialization and letting the compiler do the work: apple/swift-openapi-runtime#9 (comment).

We approved the PR as-was because it matched the pattern we were using in the rest of the code base and was a targeted fix for an issue.

This issue is to track revisiting the dynamic type checking pattern in all the places its used in the runtime library and adopting the pattern in the linked PR comment.

Metadata

Metadata

Labels

area/runtimeAffects: the runtime library.kind/enhancementImprovements to existing feature.size/SSmall task. (A couple of hours of work.)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions