Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jsonschema2md
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fork
jsonschema2md
Commits
24593da7
Unverified
Commit
24593da7
authored
7 years ago
by
Anjan Kaur
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #65 from robinvenneman/feature/57-suppress-schema-output
Feature/57 suppress schema output
parents
45bd5646
c40e2dc2
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cli.js
+2
-2
2 additions, 2 deletions
cli.js
lib/schema.js
+6
-5
6 additions, 5 deletions
lib/schema.js
with
8 additions
and
7 deletions
cli.js
+
2
−
2
View file @
24593da7
...
@@ -32,7 +32,7 @@ var argv = require('optimist')
...
@@ -32,7 +32,7 @@ var argv = require('optimist')
.
alias
(
'
s
'
,
'
metaSchema
'
)
.
alias
(
'
s
'
,
'
metaSchema
'
)
.
describe
(
'
s
'
,
'
Custom meta schema path to validate schemas
'
)
.
describe
(
'
s
'
,
'
Custom meta schema path to validate schemas
'
)
.
alias
(
'
x
'
,
'
schema-out
'
)
.
alias
(
'
x
'
,
'
schema-out
'
)
.
describe
(
'
x
'
,
'
output JSON Schema files including description and validated examples in the _new folder at output directory
'
)
.
describe
(
'
x
'
,
'
output JSON Schema files including description and validated examples in the _new folder at output directory
, or suppress with -
'
)
.
alias
(
'
e
'
,
'
schema-extension
'
)
.
alias
(
'
e
'
,
'
schema-extension
'
)
.
describe
(
'
e
'
,
'
JSON Schema file extension eg. schema.json or json
'
)
.
describe
(
'
e
'
,
'
JSON Schema file extension eg. schema.json or json
'
)
.
alias
(
'
n
'
,
'
no-readme
'
)
.
alias
(
'
n
'
,
'
no-readme
'
)
...
@@ -56,7 +56,7 @@ var schemaPathMap = {};
...
@@ -56,7 +56,7 @@ var schemaPathMap = {};
var
metaElements
=
{};
var
metaElements
=
{};
var
schemaPath
=
path
.
resolve
(
argv
.
d
);
var
schemaPath
=
path
.
resolve
(
argv
.
d
);
var
outDir
=
path
.
resolve
(
argv
.
o
);
var
outDir
=
path
.
resolve
(
argv
.
o
);
var
schemaDir
=
argv
.
x
?
path
.
resolve
(
argv
.
x
)
:
outDir
;
var
schemaDir
=
argv
.
x
===
'
-
'
?
''
:
argv
.
x
?
path
.
resolve
(
argv
.
x
)
:
outDir
;
var
target
=
fs
.
statSync
(
schemaPath
);
var
target
=
fs
.
statSync
(
schemaPath
);
const
readme
=
argv
.
n
!==
true
;
const
readme
=
argv
.
n
!==
true
;
const
schemaExtension
=
argv
.
e
||
'
schema.json
'
;
const
schemaExtension
=
argv
.
e
||
'
schema.json
'
;
...
...
This diff is collapsed.
Click to expand it.
lib/schema.js
+
6
−
5
View file @
24593da7
...
@@ -388,13 +388,12 @@ Schema.setSchemaPathMap=function(schemaMap){
...
@@ -388,13 +388,12 @@ Schema.setSchemaPathMap=function(schemaMap){
* @param {*} schemaMap
* @param {*} schemaMap
* @param {*} schemaPath
* @param {*} schemaPath
* @param {string} docDir - where documentation will be generated
* @param {string} docDir - where documentation will be generated
* @param {string} schemaDir - where schemas will be generated, if n
ull, `docDir`
will be
used
* @param {string} schemaDir - where schemas will be generated, if n
ot set, no schema's
will be
output
* @param {map} metaElements - a map of additional YAML frontmatter to be added to the generated Markdown
* @param {map} metaElements - a map of additional YAML frontmatter to be added to the generated Markdown
* @param {boolean} readme - generate a README.md directory listing
* @param {boolean} readme - generate a README.md directory listing
* @param {map} docs - a map of documentation links for headers
* @param {map} docs - a map of documentation links for headers
*/
*/
Schema
.
process
=
function
(
schemaMap
,
schemaPath
,
docDir
,
schemaDir
,
metaElements
,
readme
,
docs
)
{
Schema
.
process
=
function
(
schemaMap
,
schemaPath
,
docDir
,
schemaDir
,
metaElements
,
readme
,
docs
)
{
schemaDir
=
schemaDir
?
schemaDir
:
docDir
;
smap
=
schemaMap
;
smap
=
schemaMap
;
let
keys
=
Object
.
keys
(
schemaMap
);
let
keys
=
Object
.
keys
(
schemaMap
);
return
Promise
.
mapSeries
(
keys
,
schemaKey
=>
{
return
Promise
.
mapSeries
(
keys
,
schemaKey
=>
{
...
@@ -420,9 +419,11 @@ Schema.process = function(schemaMap, schemaPath, docDir, schemaDir, metaElements
...
@@ -420,9 +419,11 @@ Schema.process = function(schemaMap, schemaPath, docDir, schemaDir, metaElements
return
{
mSchema
:
mSchema
,
wSchema
:
allSchema
,
dep
:
wmap
};
return
{
mSchema
:
mSchema
,
wSchema
:
allSchema
,
dep
:
wmap
};
});
});
}).
then
(
object
=>
{
}).
then
(
object
=>
{
return
Promise
.
all
([
const
outputTasks
=
[
markdownWriter
(
schemaMap
[
schemaKey
].
filePath
,
object
.
mSchema
,
schemaPath
,
docDir
,
object
.
dep
,
docs
)
];
markdownWriter
(
schemaMap
[
schemaKey
].
filePath
,
object
.
mSchema
,
schemaPath
,
docDir
,
object
.
dep
,
docs
),
if
(
schemaDir
!==
''
)
{
schemaWriter
(
schemaMap
[
schemaKey
].
filePath
,
object
.
wSchema
,
schemaPath
,
schemaDir
)
]);
outputTasks
.
push
(
schemaWriter
(
schemaMap
[
schemaKey
].
filePath
,
object
.
wSchema
,
schemaPath
,
schemaDir
));
}
return
Promise
.
all
(
outputTasks
);
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
logger
.
error
(
'
Error occured in processing schema at path %s
'
,
sPath
);
logger
.
error
(
'
Error occured in processing schema at path %s
'
,
sPath
);
logger
.
error
(
err
);
// should we exit here or allow processing of other schemas?
logger
.
error
(
err
);
// should we exit here or allow processing of other schemas?
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment