Giter VIP home page Giter VIP logo

Comments (6)

catsby avatar catsby commented on May 8, 2024

The v3 fixtures should all be pretty-printed. I'll convert v2's tonight, going forward the v3 ones should all be pretty too.

from octokit.rb.

sferik avatar sferik commented on May 8, 2024

The primary purpose of the fixtures is to simulate a response from the GitHub API, so I'm against modifying them, to avoid masking parsing errors.

It's unclear to me exactly why people are reading the fixtures, but here are a couple alternatives to modifying them:

  1. Recommend that users pipe the fixture data through prettify_json.rb, for example:

    cat spec/fixtures/timeline.json | prettify_json.rb
    
  2. Adding more details about what each method returns to the Octokit YARD documentation

  3. Creating a separate directory of pretty-printed JSON responses, which aren't used by the specs.

Of the above options—all of which I'd prefer over modifying the existing fixtures—I would lean toward 2, however, since I don't understand the exact use case for reading the fixtures, that may or may not be an adequate solution. You tell me.

from octokit.rb.

sferik avatar sferik commented on May 8, 2024

PS: Here's an example of what better YARD documentation could look like: http://rdoc.info/gems/mtgox/0.6.0/MtGox/Client#sells-instance_method

Would something like that solve the problem?

from octokit.rb.

benatkin avatar benatkin commented on May 8, 2024

I'm reading them because I added octokit to my editor project and they come up when searching with Command-T and are pretty useful. I just ran it through the json prettifier myself.

I like number 1 the best, unless a conclusion is reached that pretty-printing doesn't significantly impair testing. I'll just go ahead and continue to do that (that's what I did). A rake task could be helpful, though.

from octokit.rb.

sferik avatar sferik commented on May 8, 2024

Okay, if that works I'm going to close this issue. If you write a rake task and submit a pull request, I'd be happy to take a look at it, but I think improving the documentation would be a better use of time.

from octokit.rb.

catsby avatar catsby commented on May 8, 2024

@sferik Good point, I hadn't considered that since majority of my work in the project has been with v3 of the API, which already returns data in a pretty format (see here for comparison: https://gist.github.com/1081629 ).

So in theory this will be moot when Octokit is fully converted to v3.

Also, If you have the jsonpretty gem installed you can just pipe into that: | jsonpretty

from octokit.rb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.