FormBuilder
How to use:
Install
npm i openapi-form-generator
OR
yarn add openapi-form-generator
Add Props
<FormBuilder
openApiOptions={{
//Handle Response
//Optional, but Recommended
onResponseReceived: (data, response) => {
console.log(data); //Response Data Object
console.log(response); //Full Response with Headers + Status + Status Code
},
//Where to find the json file
src: '/my/api/v1/swagger.json',
baseUrl: 'http://api.website.com/',
path: '/api/path/as/in/paths/of/json'
}}
//Useful for seeing Full Request/Response (Remove in production)
debug
//TODO: check NODE_ENV if production
/>
🌟 Done!🌟
What does it use?:
- DateTime / Date - react-datetime
- Enums - react-select
Form Structure:
<form class="form">
<div class="field">
<label class="label"></label>
<input class="input" /> OR <textarea class="textarea"></textarea>
</div>
<br />
<button class="button"></button>
</form>
Contribution:
To start developing, run:
npm t
OR
npm test
This will run a test server for the test-app
folder with hot-reloading etc.