Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support keys longer than 1024 characters #942

Closed
mvarendorff2 opened this issue Jul 24, 2024 · 0 comments · Fixed by #965
Closed

Support keys longer than 1024 characters #942

mvarendorff2 opened this issue Jul 24, 2024 · 0 comments · Fixed by #965

Comments

@mvarendorff2
Copy link

mvarendorff2 commented Jul 24, 2024

Is your feature request related to a problem? Please describe.

I have a usecase for parsing pnpm-lock.yaml files using this library. Unfortunately, PNPM does not really seem to be concerned with the spec when it comes to key-length (spec says 1024 is the max, pnpm emitted a key of length >1080 in one of my testcases).

Describe the solution you'd like

I'd love to have a new function on the DeserializerBuilder(), maybe something like .WithMaxKeyLength() that allows defining a larger than the default value when deserializing.

Describe alternatives you've considered

  1. Shortening the keys myself with a regex replace or something like that - I don't have a requirement for accurate keys in this specific case at least not for the long ones
  2. Opening an issue with pnpm to adhere to the spec but given that the keys are relevant for them for faster caching, I am not sure this will have much chance of actually going through

Additional context

Reprocase:

const string yamlString = """
                   '@angular/material@17.3.1(@angular/animations@17.3.4(@angular/core@17.3.4(rxjs@7.8.1)(zone.js@0.14.4)))(@angular/cdk@17.3.1(@angular/common@17.3.4(@angular/core@17.3.4(rxjs@7.8.1)(zone.js@0.14.4))(rxjs@7.8.1))(@angular/core@17.3.4(rxjs@7.8.1)(zone.js@0.14.4))(rxjs@7.8.1))(@angular/common@17.3.4(@angular/core@17.3.4(rxjs@7.8.1)(zone.js@0.14.4))(rxjs@7.8.1))(@angular/core@17.3.4(rxjs@7.8.1)(zone.js@0.14.4))(@angular/forms@17.3.4(@angular/common@17.3.4(@angular/core@17.3.4(rxjs@7.8.1)(zone.js@0.14.4))(rxjs@7.8.1))(@angular/core@17.3.4(rxjs@7.8.1)(zone.js@0.14.4))(@angular/platform-browser@17.3.4(@angular/animations@17.3.4(@angular/core@17.3.4(rxjs@7.8.1)(zone.js@0.14.4)))(@angular/common@17.3.4(@angular/core@17.3.4(rxjs@7.8.1)(zone.js@0.14.4))(rxjs@7.8.1))(@angular/core@17.3.4(rxjs@7.8.1)(zone.js@0.14.4)))(rxjs@7.8.1))(@angular/platform-browser@17.3.4(@angular/animations@17.3.4(@angular/core@17.3.4(rxjs@7.8.1)(zone.js@0.14.4)))(@angular/common@17.3.4(@angular/core@17.3.4(rxjs@7.8.1)(zone.js@0.14.4))(rxjs@7.8.1))(@angular/core@17.3.4(rxjs@7.8.1)(zone.js@0.14.4)))(rxjs@7.8.1)':
                     dependencies: []
                   """;
var deserializer = new DeserializerBuilder().Build();
var yaml = deserializer.Deserialize<Dictionary<string, object>>(yamlString);

Error:

Unhandled exception. (Line: 1, Col: 1, Idx: 0) - (Line: 1, Col: 1089, Idx: 1088): Exception during deserialization
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 a pull request may close this issue.

1 participant