sky-uk / api-explorer Goto Github PK
View Code? Open in Web Editor NEWAPI Explorer is a live documentation client for Swagger/OpenAPI Specification
Home Page: http://sky-uk.github.io/api-explorer
License: BSD 3-Clause "New" or "Revised" License
API Explorer is a live documentation client for Swagger/OpenAPI Specification
Home Page: http://sky-uk.github.io/api-explorer
License: BSD 3-Clause "New" or "Revised" License
A TabWidget plugin need to have a way to define a reducer to store/manage it's own state.
This will allow us to, for instance, present detailed information in other operation tab.
This method creates the APIExplorer.plugins prop. If we miss this .configPlugins() call the prop is undefined.
Set default value in APIExplorer constructor or elsewhere. ;-)
We have a error in mocha when we import a css in component.
We should find a way to prevent this
It would be nice to have something that could elegantly change the spec.
e.g. Change the path of the 'host' and 'basepath' to a custom one
A TabWidget plugin need to have a way to define a reducer to store/manage it's own state.
The idea is to load a diferent spec. We can use a url in the query string or a settings page to add new apis to the current app (of course this will not be persisted in any way)
In a first phase we could make only the query string aproach
We need to export api-explorer as NPM package to became usable by other teams.
Create a way to deploy api-explorer to heroku. Options:
a. Build server (CircleCI) step to deploy the master branch of api-explorer to herouku
b. GitHub hook
Use the sample files from redux: https://github.com/reactjs/redux/blob/master/book.json
/docs
Also, check https://github.com/reactjs/redux/blob/gh-pages/package.json#L31 on how to integrate in the build (to use github pages).
Documentation will live here: https://sky-uk.github.io/api-explorer
sample: "/pet/findByTags" in petstore
Fetching resources, more specifically, swagger specifications over HTTP is causing an error related with Mixed Content rule. This rule states that websites over HTTPS should not request content over an insure protocol such as HTTP, due to the vulnerabilities that such act may led.
Sample error using Pet Store over HTTP:
Mixed Content: The page at 'https://apiexplorer-app.herokuapp.com/?swaggerSpec=http%3A%2F%2Fpetstore.sw…waggerLoader=swagger1API&swaggerUseProxy=true&swaggerLoader=Swagger2Loader' was loaded over HTTPS, but requested an insecure resource 'http://petstore.swagger.io/v2/swagger.json'. This request has been blocked; the content must be served over HTTPS.
Reproducing this error:
We should discuss what should be the behaviour of the UI when faced with such scenario.
For requests to spec's being server HTTP, I think the check "use proxy because of CORS" should be checked and grayed out. Since in this case we want always to bypass the validation in the server side, and also make sure the received content is in fact what we expect to receive, i.e, a proper swagger specification.
We should use a markdown processor to parse apispec.info.description to display in home page.
This information should not be displayed in the other pages (widget). Only the API title should remain visible.
When passing a swagger specification to the API Explorer the preceding request URI is malformed.
Reproducing this scenario:
Output URI
As we can see the swaggerSpec
parameter contains the encoded URI bellow:
http%3A%2F%2Fpetstore.swagger.io%2Fv2%2Fswagger.json&swaggerLoader%5B%5D=swagger1API&swaggerLoader%5B%5D=Swagger2Loader&swaggerUseProxy%5B%5D=true&swaggerUseProxy%5B%5D=on
If we decode this URI we will get:
The parameters &swaggerUseProxy[]=on and swaggerLoader[]=swagger1API should not being sent, and also the construct above [URI][¶m=value¶m=value]
is invalid according to the URI RFC specification querystring part is not being preceded by an question mark (?
).
On the screenshot of the API Explorer README containing the use case GIF, we can see that this bug was already present by then:
Tests are failing because global APIExplorer requirement for plugin reducers.
Sample URL:
https://apiexplorer-app.herokuapp.com/?swaggerSpec=http://adeetc.thothapp.com/swagger/docs/v2&swaggerUseProxy=on
Accept custom parameters in TryItOut tab.
Use the URL parameters ?param-<key1>=<value>¶m-<key2>=<value2>
To set the value:
{
key1: value,
key2: value2
}
Impementation of the Try Out page with all the information that comes from the Swagger Spec
This will better express the intent of this configuration element in the APIExplorer configuration API.
APIExplorer
.config(c => {
c.swagger2API('petstore', 'http://localhost:3000/samples/petstore.json', true)
})
We should create a more complex sample in order to test other functionalities of API explorer.
Petshop should remain a very basic example (hello world style) and this new sample should be richer in features.
Some goals:
A pre-requirement of this is to get hold of some swagger samples that align with our target license.
@nunoas, some of your commits are from an unrecognised email.
The register of samples is very explicit because we are defining the paths of the where to read the samples from.
We should read the sample directories and, by convention, call the api.js file and register the endpoints of the samples.
recursive(__dirname + '/sampleapp', function (err, files) { var apiFiles = Enumerable.from(files).where(f => f.indexOf('api.js') > 1).toArray() for(i in apiFiles){ console.log(apiFiles[i]) var api = require(apiFiles[i]) api(app,basePath) } })
see server.js
This will be a new page that hold application settings (core, plugins)
Safari does not have fetch API. We need to add a pollyfil
Create a sample project that depends on api-explorer to configure a specific Swagger API.
For example, we can configure a folder (or even a git repository) named petshop-api-explorer
The idea is to split the Try out, spec and Response Schema into different components, maintaining the current logic.
In the context of this issue we should also give support for the additions of new operations
With some swagger specs (twitter) the load of the Response Schema is very slow
Impementation of the Schema page with all the information that comes from the Swagger Spec
Impementation of the Spec page with all the information that comes from the Swagger Spec
example:
npm run dev:petstore
will the petstore sample
Cache the API responses like the initial swagger spec response.
This should be configurable in a settings page
Response widget is using request format and not response content type.
When using images in our components, we should call require to include those images. That will enable Webpack to export them as dependencies automatically, making the code cleaner.
So instead of this:
<img src='data:image/png;base64,iVBOR....' />
We will have something like this:
<img src={ import `${ASSETS_DIR}/my-image.png` />
With this we guarantee that CI fails if we are not StandardJS compliant.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.