Adopt FoundationEssentials when available#14
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use explicit String(unit) conversion from Substring since FoundationEssentials doesn't implicitly convert Substring to String. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Regenerated model files from K8s v1.34.6 OpenAPI spec. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@t089 The code generated by And one other thing, If you want, I can take it from here. Just let me know 😉 Thanks! |
|
Generated model for v1.35.3 is ready. I could push on a branch if you want to incorporate it, or directly on main. |
|
Feel free to take it from here. I've already suspected that there are a couple of hidden steps ;) thanks for the help! |
|
actually, I've reverted the generated files on this branch now. So this branch now only contains changes to non-generated files. |
| let regex = try! NSRegularExpression(pattern: "^\\d*\\.?\\d*e?\\d*", options: []) | ||
| let results = regex.matches(in: str, options: [], range: range) | ||
| if results.count != 1 { | ||
| let regex = /^\d*\.?\d*e?\d*/ |
There was a problem hiding this comment.
This won't compile w/o increasing min SDKs to: .macOS(.v13), .iOS(.v16), .tvOS(.v16), .watchOS(.v9) and swift-tools-version to 5.7
| func pow(_ base: Int, _ exponent: Int) -> Decimal { | ||
| let baseDecimal = Decimal(base) | ||
| if exponent < 0 { | ||
| return 1 / pow(Decimal(base), -1 * exponent) | ||
| var result = Decimal(1) | ||
| for _ in 0 ..< -exponent { | ||
| result /= baseDecimal | ||
| } | ||
| return result | ||
| } else { | ||
| return pow(Decimal(base), exponent) | ||
| var result = Decimal(1) | ||
| for _ in 0 ..< exponent { | ||
| result *= baseDecimal | ||
| } | ||
| return result | ||
| } |
There was a problem hiding this comment.
This is what claude came up with ... apparently Swift 6.0 is missing the pow(Decimal, Int) method
|
@iabudiab Sorry, fixed the formatting and also validated locally that it builds in all the swift versions the CI is using. We could consider moving the minimum to 6.0 or even 6.1. Not sure what the ecosystem recommendation was, maybe last two previous minor versions? |
|
@t089 no worries at all. As I've mentioned in the PR for the client, I wanted to increase the baseline to Swift 6.0 anyway. I'll merge your changes and take it from here ;) Thank you very much for the PRs. (and the trigger to do some updates) |
This integrates the generated model classes using
FoundationEssentialsand ensures that all non-generated code only usesFoundationEssentials. This requires moving some API fromFondation-API to stdlib.Related: swiftkube/modelgen#3