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

Non-obvious error message when unable to borrow string and there aren't obvious escape sequences #1144

Open
skeggse opened this issue Jun 21, 2024 · 1 comment

Comments

@skeggse
Copy link

skeggse commented Jun 21, 2024

I'm trying to deserialize an OCI manifest into some structs that have &'a str fields, and serde_json is indicating that it can't do that for some specific values. I can fix the issue by using Cow<'a, str> instead, but I'm kinda curious to understand why this is happening. I can understand why this would happen for escape sequences, but I don't seem to have any escape sequences in my JSON! Are there other reasons this might be happening?

invalid type: string "application/vnd.docker.distribution.manifest.v2+json", expected a borrowed string at line 1 column 165

References:

@skeggse
Copy link
Author

skeggse commented Jun 21, 2024

Ok I should have looked closer at the input - I guess the AWS ECR API escapes the forward-slashes?

Maybe a realistic issue here is to make the error message a little clearer. I don't suppose there's a way to have it show the source bytes rather than the string after it's been had its escape sequences resolved?

@skeggse skeggse changed the title Cannot borrow string, but there aren't any escape sequences Non-obvious error message when unable to borrow string and there aren't obvious escape sequences Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant