I've been search for a couple of months now for nice swagger to HTML converter and I can't seem to find anything that will generate something that looks like the Strava API reference (https://strava.github.io/api/v3/routes/#list) or the Paypal API reference (https://developer.paypal.com/docs/api/payments.billing-plans#plan_create).
They are not the only one with this template so I'm guessing it's an HTML generator that I just couldn't find with my google search skills. Anybody knows how to generate doc looking like this without coding it yourself?
Given that you already have the Swagger/OpenAPI spec, you can use Swagger Codegen to generate documentation.
Go to https://editor.swagger.io
Import your Swagger spec under "File" in the top menu
Under "Generate Client" in the top menu, select Html2 (preferred), HTML or dynamic HTML.
(https://editor.swagger.io leverages https://generator.swagger.io to generate code and https://generater.swagger.io is powered by swagger-codegen)
Related
I need an app that takes REST API spec and builds HTML forms for client input. Is there something like that out there? I'm not sure if I'm searching the right terms.
I am building a static blog, which uses Marked to parse markdown. I want to be able to have code blocks with tabs.
I want to parse code that looks like this:
```JavaScript
var geolocation = require("nativescript-geolocation");
```
```TypeScript
import geolocation = require("nativescript-geolocation");
```
To something like this (from the angular2 docs), where the tab names would be JavaScript and TypeScript.
I am programming in JavaScript (nodeJs), so I could manually render this if required? What would a custom implementation of a code block tab look like?
I am not sure if there is a special name for these, as I can't really seem to find any examples or templates.
I think answer is: 'Marked' does not support custom tags. I've spend few hours trying to find some way to extend it and finally switched to showdown.
It appears to be really easy to implement one ( her is expandable section tag example ).
Extension 'showdownjs/prettify-extension' implements code highlighting using Google Prettify.
I'm very new to Angular and I've been doing tutorials and reading books. I'm trying to get an autocomplete from a JSON result. I got the JSON result to iterate over a table, but I need to be able to search with autocomplete based off of that same JSON result.
I have a Plnkr below. Any help would be greatly appreciated.
http://plnkr.co/edit/VObrSPu94rS3dGyVqaXk
If you pop open your developer console, you'll see that there is an error being thrown from your ngAutocomplete.js file. It looks like that directive is designed to be used for Google Places and is expecting you to have a Google library loaded as well.
You probably want to look for a more generic autocomplete directive. The only one I've used is the typeahead included in the Angular UI Bootstrap project, but there are a number of autocomplete modules on the Angular Modules site (the one you are using is the second one listed) that may work for you.
As Sean says, Angular UI Bootstrap (Typeahead) is a good option.
Here is a specific tutorial for that feature from my project.
I want to download the template source used in a wikipedia page (basically for generating the display text of a key). SO i am basically want this info
http://en.wikipedia.org/w/index.php?title=Template:Infobox%20cricketer&action=edit
for Template:Infobox cricketer
I have found an api for wikipedia called Template data
http://www.mediawiki.org/wiki/Extension:TemplateData
But the examples given:
http://en.wikipedia.org/w/api.php?action=templatedata&titles=Template:Stub
does not seem to work.
I think you misunderstood what Extension:TemplateData is for. It's for getting metadata about a template, which only works if that template provides those metadata.
If what you want the text of the template, you should use prop=revisions&rvprop=content, for example:
http://en.wikipedia.org/w/api.php?action=query&titles=Template:Infobox%20cricketer&prop=revisions&rvprop=content
I know there is a list of similar questions but all handle pages without user interaction (static even though some js may be there).
Let's say we've a page the user can interact (e.g. svg than changes, or html tables with drilldown - content changes). Those interactions will change the page. Same happens in stackoverflow when entering the question...
The idea is adding a button, "convert to pdf" taking the state of the html and sending to the user back a pdf version (we've a Java server).
Using the print of the browser is not the answer I'm looking for :-).
Is this a stick in the moon ?
You would have to store the parameters that generate the HTML view (i.e. what the user clicks on, what selections they make, etc). If you can have a list of parameters that generate the HTML view, you can have a method which accepts the list of parameters (JSON post?), generates the HTML view and passes it to your PDF generating routine. I'm not too familiar with Java libraries for this purpose, but PHP has TCPDF can take html output to basically generate a PDF for you. Certainly, there are Java libraries which will allow you to do the same thing, or you can use the parameters to get a list of rows/arrays which can be iterated over and output using the PDF library of your choice.
Both iTextPDF and Aspose.PDF would allow you to do that (I've seen them used in two different projects), but there is no magic and you will have to do some work.
The steps are roughly:
Get (as a string) the part of the document which you want to print with jQuery or innerHTML
Call a service on the server side to convert this to PDF
[Serverside] Use a whitlist - based tool to clean up the hmtl (unless you want to be hacked). JSoup is great for that.
[Serverside] Use IText or Aspose API to create the PDF from the HTML (this is not trivial, you will have to read the doc)
Download the document
I'd also recommend DocRaptor, an HTML to PDF API built by my company, Expected Behavior.
DocRaptor uses Prince XML to generate PDFs, and thus produces higher quality results than similar products.
Adding PDF generation to your own web application using our service is as simple as making an HTTP POST request to our server.
Here's a link to DocRaptor's home page:
DocRaptor
And a link to our API documentation:
DocRaptor API documentation