https://github.com/pponugo/excel2jsonschema
https://github.com/pponugo/excel2jsonschema
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/pponugo/excel2jsonschema
- Owner: pponugo
- License: mit
- Created: 2016-08-07T21:20:47.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-04-08T15:12:34.000Z (about 1 year ago)
- Last Synced: 2024-08-09T02:15:49.485Z (8 months ago)
- Language: JavaScript
- Size: 134 KB
- Stars: 8
- Watchers: 2
- Forks: 16
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - pponugo/excel2jsonschema - (JavaScript)
README
[](http://standardjs.com/)
[](https://dependencyci.com/github/pponugo/excel2jsonschema)
[](https://travis-ci.org/pponugo/excel2jsonschema)
[](https://coveralls.io/github/pponugo/excel2jsonschema?branch=master)
# Generate JSON Schema files from Excel Sheet## Background
In Todays world, RESTful API's and **JSON** have become the format of choice for **APIs** and applications. Initillay, there was no common standard to describe the RESTful API's or request/response data strcutres on par with SOAP servcies (WSDL/XSD). To bring the same standards, [JSON Schema](http://json-schema.org/) came with specification and solved problem of describing RESTful API's clear, human- and machine-readable documentation.However, JSON Schema is **trickier** to work with for many people. Creating the JSON Schema files **manually** is **cumbersome** and **error prone**. On other hand, tables are just simpler for people to understand and organize. More importantly, Excel provides great tools manipulating and organizing the table structure data.
## What is excel2jsonschema CLI tool?
The **excel2jsonschema** CLI tool, allows one to describe the JSON Schema in table format and the CLI tool generates JSON Schema files from table format (Excel Sheet).
###Example
####Input Excel
|Name|Property|Type|Description|
|----|--------|----|------------|
|Product|product_id|string|Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco| |will have a different product_id than uberX in Los Angeles.|
|Product|description|string|Description of product.|
|Product|display_name|string|Display name of product.|
|Product|capacity|string|Capacity of product. For example, 4 people.|
|Product|image|string|Image URL representing the product.|
####Output JSON Schema
```json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Product",
"description": "Product",
"type": "object",
"properties": {
"product_id": {
"description": "Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles.",
"type": "string"
},
"description": {
"description": "Description of product.",
"type": "string"
},
"display_name": {
"description": "Display name of product.",
"type": "string"
},
"capacity": {
"description": "Capacity of product. For example, 4 people.",
"type": "string"
},
"image": {
"description": "Image URL representing the product.",
"type": "string"
}
},
"required": []
}
```## Install
```npm install -g excel2jsonschema```## Usage
```
How to Execute:
excel2jsonschema -i ./sample.xls -s Schema -o ./distUsage: excel2jsonschema [options]
Options:
-i, --inputExcelFile 'File Localtion' which contains Schema definations
-s, --sheetName 'Sheet Name' which contains Schema definations
-o, --outputDir 'Output Directory' where JSON Schema files should be generated## Install
-e, --embedded 'Embedded' If embedded Schema should be generated (default: false)```
## Examples
* [sample.xlsx](https://github.com/pponugo/excel2jsonschema/blob/master/example/sample.xlsx)
* [advanced-sample.xlsx](https://github.com/pponugo/excel2jsonschema/blob/master/example/advanced-sample.xlsx)