httpbook
httpbook copied to clipboard
Publishing as Webapp
Hi there!
First, fantastic work on httpyac and the surrounding ecosystem. I come from an IJ background and have for a long time enjoyed using their rest client; so when I switched to VSCode I was very glad to stumble on your extension. I'm starting to realize, however, that I can use your http file format for a lot more than just running sample code in my IDE. The extensive testing support and Notebook integration really has me thinking this could be a replacement for something like swagger and or my usual api doc publishing.
At the moment, unless I'm mistaken, the httpbook support is limited to being used from within VSCode. Have you explored publishing httpbook's as web apps.
I'm imagining a markdown or asciidoc file that sits within my code's repo which not only drives out tests using the httpyac cli but is also auto-published to something like github pages as an interactive notebook.
1 readable / diffable document serving multiple purposes, absolutely amazing if possible.
Appreciate your time.
could be a replacement for something like swagger
I would not replace OpenAPI but maybe just add to it. I think http files are a good way to document and explain your interface for a developer. However OpenAPI with JSON schema is more detailed and better suited for code generation.
Have you explored publishing httpbook's as web apps.
I have already thought about how to adjust the code to support vscode.dev/ github.dev as well. This would require me to replace all uses of NodeJS packages with browser compatible modules. For example, using got
for Http requests would not be possible in the browser. For the reason I have already extracted this a separate plugin. Basically the core would already be compatible, but some more steps are necessary.
- You would have to build the runtime that handles the parsing and execution for the plugins and also the plugins as their own independent packages.
- The plugins must be provided to the CLI APP and Vscode extension. The idea is to restructure the project here and build it as a MonoRepo to avoid a publish via NPM.
- For plugins that are only NodeJS compatible, but are actually of central importance (http request, javascript, assert), a browser compatible version must be created
- In the end, it's exciting to see which parts still cause problems after all the conversions. For this reason, you should also increase the test coverage to have sufficient certainty.
So in short, yes, thought of it, but sporty in implementation
Thank you so much for your response.
Agree with you wholeheartedly that I would not consider replacing an Open API schema with an httpbook; however I might choose to use an httpbook instead of swagger ui to communicate how to use our apis in our api docs assuming we could publish them as standalone apps.
Seems like you've given this plenty of thought and I won't pretend to understand more than about 40% of what you said but I'm glad to see it's on your radar. Consider this ticket a plus 1 to the feature request. I don't have many cycles outside of work but OSS wins together so if there is some low hanging fruit that you think could be delegated in order to help inch us closer to a world where this might see the light of day; just let me know. Happy to contribute.
@AnWeber I just came across https://webcontainers.io. - do you now this? AFAIK it's webassembly module allowing nodejs in browser. Based on this I made a super dirty POC running httpyac inside chrome:
http://www.rngtng.com/httpyac-web/
Performance is quite bad, but I'm pretty sure there's a lot to optimize
see sources: https://github.com/rngtng/httpyac-web
@rngtng Awesome. I did not know that. Awesome stuff. I wouldn't have believed you could get something like this to work. But yeah is slow. The browser has to load quite a bit.
Wow, plus one to AnWeber; that is suuper cool @rngtng! Thank you so much for sharing. I'll be watching your project closely to see if we an get the performance to an acceptable level as well as allowing input from the user for script vars. Really excited to use this on my future projects. <3