-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Render JSON and YAML inscriptions as text #1449
Conversation
src/media.rs
Outdated
@@ -50,6 +50,8 @@ impl FromStr for Media { | |||
} | |||
|
|||
const TABLE: &[(&str, Media, &[&str])] = &[ | |||
("application/json", Media::Text, &["json"]), | |||
("application/yaml", Media::Text, &["yaml"]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.yml
is a sometimes used file extension too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me! Added.
@windsok How comfortable are you reviewing the code? I've been operating with the following policy for merges:
This is code I've written, so I'd like to get another review before merging. This PR is simple, but it's nice to sanity check, and make sure my reasoning for a feature makes sense.
For this PR, since you've taken a look, do you feel comfortable giving an ack? Ideally you should understand the code and what it's doing, and any implications, and if you don't you can ask me questions, even very simple or basic ones, and I'll explain. No pressure if you're busy or not interested! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK e286752
I understand this change fairly well as I might have hacked in a illegitimate inscription or two 😉
Rendering these as text makes sense. I guess could add some syntax highlighting in the future but this should let people start inscribing their collection JSON etc with the correct mime type
Thank you! Also, everything is tested, so when a PR, like this, has a functional change but not a corresponding new test or change to an existing test, you should be suspicious! In this case, it's okay. So far, we haven't been testing "data", things where really we would just be testing a constant. In this case, this table feels like data, so although we've tested the functions that access this table, we haven't tested individual table entries, which is why this change doesn't have a test. |
People are publishing YAML and JSON documents as text/plain. Not sure if they should get special treatment (syntax highlighting?) but at least we should recognize the content types so people can use the right content types.