Skip to main content
Homepage
Explore
Search or go to…
/
Sign in
Explore
Primary navigation
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Collapse sidebar
Snippets
Groups
Projects
Show more breadcrumbs
Fork
jsonschema2md
Commits
f98e2b47
Commit
f98e2b47
authored
Feb 11, 2019
by
Anthony
Browse files
Options
Downloads
Patches
Plain Diff
fix random order with examples
parent
95ba7412
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/schema.js
+11
-2
11 additions, 2 deletions
lib/schema.js
with
11 additions
and
2 deletions
lib/schema.js
+
11
−
2
View file @
f98e2b47
...
...
@@ -353,9 +353,18 @@ Schema.getExamples = function(filePath, schema){
return
fs
.
readFileAsync
(
entry
).
then
(
example
=>
{
var
data
=
JSON
.
parse
(
example
.
toString
());
var
valid
=
validate
(
data
);
if
(
valid
)
{
examples
.
push
(
data
);}
else
{
logger
.
error
(
entry
+
'
is an invalid Example
'
);}
if
(
valid
)
{
examples
.
push
({
filename
:
entry
,
data
:
data
});}
else
{
logger
.
error
(
entry
+
'
is an invalid Example
'
);}
});
}).
then
(()
=>
{
// Sort according to filenames in order not to have random prints
examples
.
sort
(
function
(
a
,
b
)
{
return
a
.
filename
>
b
.
filename
?
1
:
-
1
;
});
logger
.
error
(
examples
);
examples
=
examples
.
map
(
function
(
element
)
{
return
element
.
data
;
});
schema
.
examples
=
examples
;
return
schema
;
});
}).
then
(()
=>
{
schema
.
examples
=
examples
;
return
schema
;
}
);
}
else
{
return
schema
;}
});
};
...
...
...
...
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
sign in
to comment