rust-playground icon indicating copy to clipboard operation
rust-playground copied to clipboard

Gists created without descriptions cannot be loaded

Open voidash opened this issue 3 years ago • 1 comments

Whenever i create a public gist using GitHub API, and try to open it on Rust playground using https://play.rust-lang.org/?gist=211bb09a91daf972934a13d6aee9e178; The editor isn't able to fetch contents of that gist. I looked into the console tab on inspect section on my browser, i saw a error of this kind. image

on further inspection , i found out, the application fetches gist contents by sending GET request to https://play.rust-lang.org/meta/gist/211bb09a91daf972934a13d6aee9e178 and for all the gist created using API it is returning 500 server error.

Here is the curl request

curl -X  POST  \
-H "Authorization: token [my-token] " \
-H "Accept: application/vnd.github.v3+json" \
-d '{"public": true, "files": {"[filename]": {"filename": "my_public_file", "content": "pub fn main() { println!("test") }"}}}' 
https://api.github.com/gists \

voidash avatar Jan 28 '22 15:01 voidash

From the error log, it appears that your gist doesn't have a description field (Error("invalid type: null, expected a string", line: 1, column: 2879)).

This is a mistake in the definition of the model in octocrab. To resolve this:

  1. You'll need to submit a PR making that field optional or having a default value
  2. The PR will need to be merged
  3. A new release of octocrab
  4. The playground uses the new release

create a public gist using GitHub API

The playground creates gists using the API as well.

shepmaster avatar Jan 31 '22 15:01 shepmaster