Skip to content
Snippets Groups Projects
Commit c2925cbc authored by Anjan Kaur's avatar Anjan Kaur Committed by GitHub Enterprise
Browse files

Merge branch 'master' into refs

parents 9b76ddc2 1b8a1204
No related branches found
No related tags found
No related merge requests found
# Contributing to Adobe Cloud Platform XDM Machinery
# Contributing to Adobe Cloud Platform JSON Schema Markdown Tools
The XDM Machinery project is an Open Development/Inner Source project and welcomes contributions from everyone at Adobe.
This project is an Open Development/Inner Source project and welcomes contributions from everyone at Adobe.
## Things to Keep in Mind
The XDM Machinery project uses a **commit then review** process, which means that for approved maintainers, changes can be merged immediately, but will be reviewed by others.
This project uses a **commit then review** process, which means that for approved maintainers, changes can be merged immediately, but will be reviewed by others.
For other contributors, a maintainer of the project has to approve the pull request.
......@@ -12,33 +12,32 @@ For other contributors, a maintainer of the project has to approve the pull requ
* Check that there is an [existing issue](https://jira.corp.adobe.com/issues/?jql=project%20%3D%20ACP%20AND%20component%20in%20(%22machinery%22)) in the ACP project
* Check if there are other pull requests that might overlap or conflict with your intended contribution
* If there is no issue, and no prior work, send a short mail to [Grp-XDM-API-WGs](mailto:Grp-XDM-API-WGs@adobe.com) with the subject line `[XDM][Machinery] Contribution …`
* If there is no issue, and no prior work, send a short mail to [Grp-XDM-API-WGs](mailto:Grp-XDM-API-WGs@adobe.com) with the subject line `[XDM][JSONSchema2MD] Contribution …`
# How to Contribute
1. Fork the repository
2. Create a pull request
3. Submit the pull request
2. Make some changes on a branch on your fork
3. Create a pull request from your branch
In your pull request, outline,
In your pull request, outline:
* What the change intends to do
* How it changes the existing code
* If (and what) it breaks
* What the changes intend
* How they change the existing code
* If (and what) they breaks (TODO: we should have tests instead. pst: working on that ;) )
* Start the pull request with the JIRA issue ID, e.g. ACP-123
Each commit message:
* Should contain the issue tag like `[ACP-123]`
* Should contain the issue ID like `[ACP-123]`
* Can contain the tag `[trivial]` for trivial changes that don't relate to an issue
## Coding Styleguides
There are no coding style guides yet.
There are no coding style guides... yet.
# How Contributions get Reviewed
One of the maintainers will look at the pull request within one week. If you haven't heard back from the maintainers within a week, it is not impolite to send a reminder to [Grp-XDM-API-WGs](mailto:Grp-XDM-API-WGs@adobe.com).
Feedback on the pull request will be given in writing, in GitHub.
\ No newline at end of file
Feedback on the pull request will be given in writing, in GitHub.
# JSON Schema Markdown Tools
Documenting and validating complex JSON Schemas can be hard. This tool maks it easier by providing a number of scripts that can turn JSON Schema files into readable Markdown documenation that is ready to be read on GitHub, or processed using Jekyll or other static site generators.
Documenting and validating complex JSON Schemas can be hard. This tool maks it easier by providing a number of scripts that can turn JSON Schema files into readable Markdown documenation that is ready for consumption on GitHub or processed using Jekyll or other static site generators.
These tools have been introduced by Adobe to document Adobe's Experience Data Models (XDM), but can be used for other JSON Schema documents, too.
......@@ -11,14 +11,14 @@ These tools have been introduced by Adobe to document Adobe's Experience Data Mo
## Installing and running
```bash
# clone models project
$ git clone git@git.corp.adobe.com:AdobeCloudPlatform/models.git
# clone XDM project
$ git clone git@git.corp.adobe.com:AdobeCloudPlatform/xdm.git
# clone machinery project
$ git clone git@git.corp.adobe.com:AdobeCloudPlatform/machinery.git
# clone this project
$ git clone git@git.corp.adobe.com:AdobeCloudPlatform/jsonschema2md.git
# install dependencies
$ cd machinery && npm install
$ cd jsonschema2md && npm install
# show usage information
$ node index.js
......@@ -28,15 +28,16 @@ $ node index.js
# Usage: node index.js
#
# Options:
# -d, --input path to directory containing all JSON Schemas or a single JSON Schema file. This will be considered as the baseURL [required]
# -f, --isFile pass if input is a single file path
# -o, --out path to output directory (default: ./out)
# -x, --schema-out pass to output JSON Schema files including description and validated examples in the _new folder at output directory
# -s, --metaSchema pass it followed by path to Custom meta schema to validate other schemas
# -d, --input path to directory containing all JSON Schemas or a single JSON Schema file. This will be considered as the baseURL [required]
# -f, --isFile pass if input is a single file path
# -o, --out path to output directory (default: ./out)
# -m, --meta add metadata elements to .md files Eg -m template=reference. Multiple values can be added by repeating the flag Eg: -m template=reference -m hide-nav=true
# -x, --schema-out output JSON Schema files including description and validated examples in the _new folder at output directory
# -s, --metaSchema path to Custom meta schema to validate other schemas
# run task
node index.js -d ../models/schemas/draft-04/
$ node index.js -d ../xdm/schemas/draft-04/
# generated output for whole folder is written to ./out
```
......@@ -56,11 +57,10 @@ You can conveniently use the JSON Schema Markdown Tools from `npm`. This makes i
```json
"devDependencies": {
"adobecloudplatform-machinery": "git+ssh://git@git.corp.adobe.com:AdobeCloudPlatform/machinery.git"
"jsonschema2md": "git+ssh://git@git.corp.adobe.com:AdobeCloudPlatform/jsonschema2md.git"
}
```
Then add the following to the `"scripts"` section of your `package.json` and adapt accordingly:
```json
......@@ -76,7 +76,7 @@ If you run `npm install` before running `npm run prepare`, `npm` will install th
* JSON Schema validation:
* property naming convention
* vocabulary spellchecking
*
* Tests
## Contributing
......
lib/schema.js 100755 → 100644
File mode changed from 100755 to 100644
{
"name": "adobecloudplatform-machinery",
"name": "jsonschema2md",
"description": "Validate and document complex JSON Schemas the easy way.",
"version": "0.1.0",
"version": "0.2.0",
"main": "index.js",
"bin": {
"jsonschema2md": "./index.js"
......@@ -28,9 +28,9 @@
},
"repository": {
"type": "git",
"url": "https://git.corp.adobe.com/AdobeCloudPlatform/machinery.git"
"url": "https://git.corp.adobe.com/AdobeCloudPlatform/jsonschema2md.git"
},
"bugs": {
"url": "https://git.corp.adobe.com/AdobeCloudPlatform/machinery/issues"
"url": "https://git.corp.adobe.com/AdobeCloudPlatform/jsonschema2md/issues"
}
}
<% if(schema.metaElements.length > 0){%>---<% _.forOwn(schema.metaElements, function (value,key) {%>
<% if(Object.keys(schema.metaElements).length > 0){%>---<% _.forOwn(schema.metaElements, function (value,key) {%>
<%- key %> : <%- value %><% }); %>
---<% }%>
......@@ -29,6 +29,7 @@
// else
// return " \n"+ HelperFunctions.createLink(refObject.$linkVal,refObject.$linkPath);
// }
},
escapeText: function(text){
return text.replace(/\n- /g,"\n - ");
......@@ -44,7 +45,7 @@
return " \n **Array of**" + " " + value.type;
else return " \n **Array Of**";
}
case "contains": return "Atleast one of the element of array should be following \n" ;
case "contains": return "At least one of the element of array should be following \n" ;
case "patternProperties": return "Pattern Specific Properties \n";
case "additionalProperties": break;
case "additionalItems": break;
......@@ -201,21 +202,21 @@
var value=object[keyword];
switch(keyword){
case "description": break;
case "multipleOf": str = str+" \n"+"This Value Should be Multiple of "+value; break;
case "maximum": str = str+" \n"+"**Maximum Value:** "+value; break;
case "exclusiveMaximum": str = str+" \n"+"**Maximum Value(Strictly less than):** "+value; break;
case "minimum": str = str+" \n"+"**Minimum Value:** "+value; break;
case "exclusiveMinimum": str = str+" \n"+"**Minimum Value(Strictly less than):** "+value; break;
case "maxLength": str = str+" \n"+"**Maximum Length:** "+value; break;
case "minLength": str = str+" \n"+"**Minimum Length:** "+value; break;
case "multipleOf": str = str+" \n"+"This value should be a multiple of "+value; break;
case "maximum": str = str+" \n"+"**Maximum value:** "+value; break;
case "exclusiveMaximum": str = str+" \n"+"**Maximum value (strictly less than):** "+value; break;
case "minimum": str = str+" \n"+"**Minimum value:** "+value; break;
case "exclusiveMinimum": str = str+" \n"+"**Minimum value (strictly less than):** "+value; break;
case "maxLength": str = str+" \n"+"**Maximum length:** "+value; break;
case "minLength": str = str+" \n"+"**Minimum length:** "+value; break;
case "pattern": str = str+" \n"+"**Pattern for the value:** " +value; break;
case "maxItems": str = str+" \n"+"**Maximum Items:** "+value ;break;
case "minItems": str = str+" \n"+"**Minimum Items:** "+value ;break;
case "maxProperties": str = str+" \n"+"**Max Properties:** ";break;//Should these be there?
case "minProperties": str = str+" \n"+"**Min Properties:** ";break;
//case "uniqueItems": str = str+" \n"+"This contains Unique Items";break;
case "maxItems": str = str+" \n"+"**Maximum number of items:** "+value ;break;
case "minItems": str = str+" \n"+"**Minimum number items:** "+value ;break;
case "maxProperties": str = str+" \n"+"**Max properties:** ";break;//Should these be there?
case "minProperties": str = str+" \n"+"**Min properties:** ";break;
//case "uniqueItems": str = str+" \n"+"This contains unique items";break;
case "examples": str = str+" \n"+"**Examples:**" + HelperFunctions.displayExamples(value);break;
case "enum": str = str+" \n"+"This value can be one of the following **Enum values**"+ HelperFunctions.displayEnum(value);break;
case "enum": str = str+" \n"+"This value can be one of the following **enum values**"+ HelperFunctions.displayEnum(value);break;
}
})
......@@ -300,11 +301,14 @@ function displayStringIfExists(object,key,str){
<% if(schema.properties && Object.keys(schema.properties).length > 0){ %>
## Properties
<% Object.keys(schema.properties).map((prop) => { var value= schema.properties[prop]; HelperFunctions.nestLevel = 0; %>
### <%- HelperFunctions.linkProperty(prop) %><%- HelperFunctions.isRequired(prop,schema.required) %><%- include('innerSchema', {nschema: value, HelperFunctions:HelperFunctions,flag:true,nchild:0,sName:HelperFunctions.linkProperty(prop)}) %><% });} %>
<% if(schema.$definitions){ %>
## Definitions
<% Object.keys(schema.definitions).map((def) => { var value= schema.definitions[def]; HelperFunctions.nestLevel = -1; %>
<% Object.keys(schema.definitions).map((def) => { var value= schema.definitions[def]; HelperFunctions.nestLevel = 0; %>
### <%- def %><%- include('innerSchema', {nschema: value, HelperFunctions:HelperFunctions,flag:true,nchild:0}) %><% });} %>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment