Code Monkey home page Code Monkey logo

Comments (17)

pollingj avatar pollingj commented on June 15, 2024

I've just hit this issue. Is there a fix for it?

from rspec_api_documentation.

oestrich avatar oestrich commented on June 15, 2024

Not yet. I'm not entirely sure how we'd fix the problem. Do we snip out the upload data or leave it in bloating the docs? If we take it out then we're not really documenting the whole example response.

I thought it might be cool to detect the upload and save it out along side the docs so we can replace it with a link so people can download it.

from rspec_api_documentation.

pollingj avatar pollingj commented on June 15, 2024

I was thinking it could detect the upload data, and just replace it with a string saying something like "upload data"?

from rspec_api_documentation.

rogercampos avatar rogercampos commented on June 15, 2024

Also hit this, a fix would be very appreciated

from rspec_api_documentation.

jejacks0n avatar jejacks0n commented on June 15, 2024

I have not yet experienced this, but I will shortly.. I was here to create a different issue, but yeah, I agree with @pollingj -- replacing it with something that indicates it was a file is fine by me.

from rspec_api_documentation.

cutalion avatar cutalion commented on June 15, 2024

Is it possible to manually add a section to docs meanwhile?

from rspec_api_documentation.

oestrich avatar oestrich commented on June 15, 2024

Sure, depends on how you're hosting them though. If you're using the HTML writer just add a new link in the index page and corresponding HTML page. The JSON writer is similar, but make sure you format the example correctly so Raddocs (or similar) can view it.

I'll look into this a little bit more and see what I can come up with.

from rspec_api_documentation.

jejacks0n avatar jejacks0n commented on June 15, 2024

Keep in mind that the path is removed before rebuilding, so you would have to do this manually every time you generate the docs.

from rspec_api_documentation.

jejacks0n avatar jejacks0n commented on June 15, 2024

I did something similar by adding a controller tests outside of the acceptance specs (for a real spec for it), and did the request/response in such a way in the acceptance specs that makes it appear as though there was a file attached in the request.

eg. let(:attachment) { '[File Attachment'] }, then find and update the record with an attachment manually (only works on update). It at least simulates it in the documentation.

from rspec_api_documentation.

oestrich avatar oestrich commented on June 15, 2024

I think I have a working solution for this. Could everyone check out this branch and see if it works for them?

https://github.com/zipmark/rspec_api_documentation/tree/uploaded_data

from rspec_api_documentation.

pvertenten avatar pvertenten commented on June 15, 2024

Doesn't seem to support files in nested documents.

from rspec_api_documentation.

Ruxton avatar Ruxton commented on June 15, 2024

@oestrich I just put a PR in to expand upon your solution that wasn't working for a few people.

from rspec_api_documentation.

dalizard avatar dalizard commented on June 15, 2024

@oestrich I am having exactly the same problem with an uploaded file. I was thinking about opening a PR, but saw this thread. What is the current state of the issue?

P.S. The uploaded_data branch does not work for me. I had to update the File.open mode in order to avoid encoding problems. See here dalizard/rspec_api_documentation@94243ef

from rspec_api_documentation.

oestrich avatar oestrich commented on June 15, 2024

@dalizard Can you try out the branch again? Merged in @Ruxton's changes.

from rspec_api_documentation.

dalizard avatar dalizard commented on June 15, 2024

@oestrich It works! Any idea as to when this could be pushed to master and released?

from rspec_api_documentation.

Ruxton avatar Ruxton commented on June 15, 2024

FWIW we've been using this as part of our CI process in 3 separate projects since I sent this PR and are yet to come across any issues

from rspec_api_documentation.

oestrich avatar oestrich commented on June 15, 2024

Awesome, I'll merge it in later today then and push a new release.

from rspec_api_documentation.

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.