Comments (17)
I've just hit this issue. Is there a fix for it?
from rspec_api_documentation.
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.
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.
Also hit this, a fix would be very appreciated
from rspec_api_documentation.
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.
Is it possible to manually add a section to docs meanwhile?
from rspec_api_documentation.
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.
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.
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.
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.
Doesn't seem to support files in nested documents.
from rspec_api_documentation.
@oestrich I just put a PR in to expand upon your solution that wasn't working for a few people.
from rspec_api_documentation.
@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.
@dalizard Can you try out the branch again? Merged in @Ruxton's changes.
from rspec_api_documentation.
@oestrich It works! Any idea as to when this could be pushed to master and released?
from rspec_api_documentation.
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.
Awesome, I'll merge it in later today then and push a new release.
from rspec_api_documentation.
Related Issues (20)
- Document multiple examples for the same endpoint
- Request headers missing when using :open_api
- Docs generation fails if upload multiple files in a test case HOT 2
- Get `NoMethodError` when there is an example that expect an api to raise 500 error HOT 5
- Can't name parameter "pending" HOT 1
- Rails 5.2 update fixture changes
- Maintenance status HOT 23
- Can we please opt-in to Hacktoberfest? 🙏🏻 HOT 4
- No ability to generate a nullable option on response fields
- Add support for context blocks in HTML index HOT 3
- Open api: Ability to add description for scope
- Sample linked in README is not working HOT 1
- Bug in OpenApi formatter with multiple examples for same HTTP action? HOT 2
- Example site is offline HOT 1
- How To: Run tests in parallel and generate documentation HOT 2
- Allow to use short example definition
- Support for the latest version of Ruby
- EOFError on trying to test upload apis without file
- Support for OAS 3.1?
- Support ruby 3.2, DEPRECATED File.exists? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rspec_api_documentation.