Skip to content

Commit

Permalink
Start documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
uppal101 committed Nov 16, 2017
1 parent 1a0fc71 commit 40aa1d1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 2 additions & 1 deletion example/src/Demo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class Demo extends React.Component {
this.setState({ docs: createDocs(oas, 'api-setting') });
}
render() {
console.log(this.state.docs);
return (
<div>
<div className="api-list-header">
Expand All @@ -65,7 +66,7 @@ class Demo extends React.Component {
oasFiles={{
'api-setting': Object.assign(extensions.defaults, this.state.oas),
}}
flags={{ correctnewlines: false }}
flags={{ correctnewlines: true }}
oauthUrl={this.props.oauthUrl}
/>
)
Expand Down
16 changes: 16 additions & 0 deletions packages/api-explorer-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@ npm install --save api-explorer-ui

## Usage

### `<ApiExplorer docs={this.state.docs} oasFiles={{
'api-setting': Object.assign(extensions.defaults, this.state.oas),
}} flags={{ correctnewlines: false, stripe: true }} oauthUrl={this.props.oauthUrl} /> `

- `docs` is an array of objects of each endpoint's path, method, and title.
- `oasFiles` is an object of swagger extensions(https://readme.readme.io/v2.0/docs/swagger-extensions) that modify the display of components within ApiExplorer or the AJAX request itself. The object also includes the documentation file of all endpoints.
- `flags` is an object of specified settings from readme that affect the display of ApiExplorer. The two main ones are correctnewlines -[docs](#correctnewlines) and stripe -[docs](#stripe).
- `oauthUrl` is a string utilized for response result body to determine authentication for the response of the endpoint.

### `correctnewlines`
- `correctnewlines` is an object with a boolean value if false it adds line breaks. This can be seen when an image is embedded with a caption.

### `stripe`
- `stripe` is an object with a boolean value it affects that changes the theme of the layout to show a stripe effect.


## Credits
[Dom Harrington](https://github.com/readme/)

Expand Down
4 changes: 3 additions & 1 deletion packages/api-explorer-ui/src/Params.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const Form = require('react-jsonschema-form').default;
const UpDownWidget = require('react-jsonschema-form/lib/components/widgets/UpDownWidget').default;
const TextWidget = require('react-jsonschema-form/lib/components/widgets/TextWidget').default;
const FileWidget = require('react-jsonschema-form/lib/components/widgets/FileWidget').default;
const DateTimeWidget = require('react-jsonschema-form/lib/components/widgets/DateTimeWidget')
.default;

const ObjectField = require('./form-components/ObjectField');
const SchemaField = require('./form-components/SchemaField');
Expand Down Expand Up @@ -39,7 +41,7 @@ function Params({ oas, operation, formData, onChange, onSubmit }) {
byte: TextWidget,
uuid: TextWidget,
duration: TextWidget,
dateTime: TextWidget,
dateTime: DateTimeWidget,
integer: UpDownWidget,
TextWidget,
}}
Expand Down

0 comments on commit 40aa1d1

Please sign in to comment.