jpsim / Yams

A Sweet and Swifty YAML parser.
https://jpsim.com/Yams
MIT License
1.11k stars 141 forks source link

Add an option for encoding scalars with newlines to Emitter.Options #406

Closed tejassharma96 closed 6 months ago

tejassharma96 commented 8 months ago

Solves #405 by adding a new option for encoding scalars which contain newlines

acecilia commented 7 months ago

Thanks! Looking forward to this. @jpsim wdyt? 🙏

danibachar commented 6 months ago

+1 for this too

tejassharma96 commented 6 months ago

ok rebased and updated the changelog 🙏

tejassharma96 commented 6 months ago

older swift versions do not understand any Protocol and the tests are failing because of that:

Encoder.swift:229:45: protocol 'StringProtocol' can only be used as a generic constraint because it has Self or associated type requirements

updated to add a #if swift(>=5.6), which I believe is when support for that was added, and for prior versions just try to cast to String instead of any StringProtocol

jpsim commented 6 months ago

@tejassharma96 just making sure you see the CI failures here.

tejassharma96 commented 6 months ago

yes, sorry - somewhat distracted. I don't have an environment where I can install old versions of xcode since I'm on sonoma :/ how would you suggest I debug?

tejassharma96 commented 6 months ago

Ah actually - based on this article, the check should be for 5.7 instead of 5.6:

in Swift 5.7 the requirements around protocols with a Self requirement have been relaxed

Updated the check, could you see if CI succeeds now please?

tejassharma96 commented 6 months ago

hmmm, one failure still but looks unrelated to this change:

Failing tests:
    YamsTests:
        PerformanceTests.testUsingComposeWithUTF8()
        PerformanceTests.testUsingComposeWithUTF8()

will see if I can repro locally

jpsim commented 6 months ago

CI is all ✅

I’ll merge shortly.

acecilia commented 6 months ago

Thank you both 🙌