dart-lang / pubspec_parse

Simple package for parsing pubspec.yaml files with a type-safe API and rich error reporting
https://pub.dev/packages/pubspec_parse
BSD 3-Clause "New" or "Revised" License
51 stars 23 forks source link

Can toJson() functionality be included as well? #17

Open thosakwe opened 6 years ago

thosakwe commented 6 years ago

It's fantastic to have an official package on Pub for parsing and extracting data from a pubspec.

There is, however, one thing, I'm wondering - would it be bad for createToJson to be true for the models contained in this package?

I'm working on updating the Angel CLI, which uses the old package:pubspec to persist changes to the project files (namely, adding dependencies the user is missing), to pubspec_parse, and if there were some way to just get a toJson method on the PubSpec.

I'll gladly send a PR, but is there is a specific reason this functionality isn't present already? I imagine there's probably a reason I didn't think about.

kevmoo commented 6 years ago

Hey @thosakwe

I think I avoided toJson because the pubspec is yaml – and the json output wouldn't necessarily round-trip the shape of the source.

There is quite a bit of special handling of dependencies, for instance.

If you want to take a shot, I'd accept a PR, though!

AliAkberAakash commented 1 year ago

@kevmoo could I work on this issue?

kevmoo commented 1 year ago

@kevmoo could I work on this issue?

Sure! Just make sure you put in plenty of tests. I want to see that at round trips cleanly, etc.

alestiago commented 7 months ago

Is this being worked on? (cc: @AliAkberAakash , @kevmoo )

AliAkberAakash commented 7 months ago

Hey @alestiago I completely forgot about this, No it's not being worked on from my side. If you want we can work on this together.

alestiago commented 2 months ago

@AliAkberAakash I don't have the bandwidth right now to work on this feature. If I ever have some spare I'll let you know. If you're no longer working on this I recommend asking to get unassigned.