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
27dbafb1
Commit
27dbafb1
authored
7 years ago
by
Lars Trieloff
Browse files
Options
Downloads
Patches
Plain Diff
[trivial] detect arrays of complex types
parent
2d2f55d4
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/docs/arrays.schema.md
+20
-20
20 additions, 20 deletions
examples/docs/arrays.schema.md
examples/docs/complex.schema.md
+3
-3
3 additions, 3 deletions
examples/docs/complex.schema.md
lib/markdownWriter.js
+1
-1
1 addition, 1 deletion
lib/markdownWriter.js
with
24 additions
and
24 deletions
examples/docs/arrays.schema.md
+
20
−
20
View file @
27dbafb1
...
...
@@ -19,13 +19,13 @@ This is an example schema with examples for multiple array types and their const
| Property | Type | Required | Defined by |
|----------|------|----------|------------|
|
[
list
](
#list
)
|
`string[]
`
| Optional | Arrays (this schema) |
|
[
listlist
](
#listlist
)
|
`array[]
`
| Optional | Arrays (this schema) |
|
[
stringlistlist
](
#stringlistlist
)
|
`string[][]
`
| Optional | Arrays (this schema) |
|
[
intlist
](
#intlist
)
|
`integer[]
`
| Optional | Arrays (this schema) |
|
[
boollist
](
#boollist
)
|
`boolean[]
`
| Optional | Arrays (this schema) |
|
[
numlist
](
#numlist
)
|
`number[]
`
| Optional | Arrays (this schema) |
|
[
coordinatelist
](
#coordinatelist
)
|
`number[][]
`
| Optional | Arrays (this schema) |
|
[
list
](
#list
)
|
`string
`
[] | Optional | Arrays (this schema) |
|
[
listlist
](
#listlist
)
|
`array
`
[] | Optional | Arrays (this schema) |
|
[
stringlistlist
](
#stringlistlist
)
|
`string
`
[][]
| Optional | Arrays (this schema) |
|
[
intlist
](
#intlist
)
|
`integer
`
[] | Optional | Arrays (this schema) |
|
[
boollist
](
#boollist
)
|
`boolean
`
[] | Optional | Arrays (this schema) |
|
[
numlist
](
#numlist
)
|
`number
`
[] | Optional | Arrays (this schema) |
|
[
coordinatelist
](
#coordinatelist
)
|
`number
`
[][]
| Optional | Arrays (this schema) |
## list
...
...
@@ -33,14 +33,14 @@ This is an array
`list`
*
is optional
*
type:
`string[]
`
*
type:
`string
`
[]
*
defined in this schema
### list Type
Array type:
`string[]
`
Array type:
`string
`
[]
All items must be of the type:
`string`
...
...
@@ -59,7 +59,7 @@ This is an array of arrays
`listlist`
*
is optional
*
type:
`array[]
`
(nested array)
*
type:
`array
`
[]
*
defined in this schema
...
...
@@ -83,14 +83,14 @@ This is an array of arrays of strings
`stringlistlist`
*
is optional
*
type:
`string[][]
`
(nested array)
*
type:
`string
`
[][]
(nested array)
*
defined in this schema
### stringlistlist Type
Nested array type:
`string[]
`
Nested array type:
`string
`
[]
...
...
@@ -113,14 +113,14 @@ This is an array
`intlist`
*
is optional
*
type:
`integer[]
`
*
type:
`integer
`
[]
*
between
`1`
and
`10`
items in the array
*
defined in this schema
### intlist Type
Array type:
`integer[]
`
Array type:
`integer
`
[]
All items must be of the type:
`integer`
...
...
@@ -139,14 +139,14 @@ This is an array
`boollist`
*
is optional
*
type:
`boolean[]
`
*
type:
`boolean
`
[]
*
at least
`1`
items in the array
*
defined in this schema
### boollist Type
Array type:
`boolean[]
`
Array type:
`boolean
`
[]
All items must be of the type:
`boolean`
...
...
@@ -163,14 +163,14 @@ This is an array
`numlist`
*
is optional
*
type:
`number[]
`
*
type:
`number
`
[]
*
no more than
`10`
items in the array
*
defined in this schema
### numlist Type
Array type:
`number[]
`
Array type:
`number
`
[]
All items must be of the type:
`number`
...
...
@@ -189,14 +189,14 @@ This is an array of coordinates in three-dimensional space.
`coordinatelist`
*
is optional
*
type:
`number[][]
`
(nested array)
*
type:
`number
`
[][]
(nested array)
*
no more than
`10`
items in the array
*
defined in this schema
### coordinatelist Type
Nested array type:
`number[]
`
Nested array type:
`number
`
[]
...
...
This diff is collapsed.
Click to expand it.
examples/docs/complex.schema.md
+
3
−
3
View file @
27dbafb1
...
...
@@ -27,7 +27,7 @@ This is an example schema that uses types defined in other schemas.
|----------|------|----------|------------|
|
[
refabstract
](
#refabstract
)
| complex |
**Required**
| Complex References (this schema) |
|
[
refnamed
](
#refnamed
)
| Simple | Optional | Complex References (this schema) |
|
[
reflist
](
#reflist
)
| Simple | Optional | Complex References (this schema) |
|
[
reflist
](
#reflist
)
| Simple
[]
| Optional | Complex References (this schema) |
## refabstract
...
...
@@ -83,14 +83,14 @@ Unknown type ``.
`
reflist
`
* is optional
* type: Simple
* type: Simple
[]
* defined in this schema
### reflist Type
Array type: Simple
Array type: Simple
[]
All items must be of the type:
* Complex type: [Simple](simple.schema.md) – `
https://example.com/schemas/simple
`
...
...
This diff is collapsed.
Click to expand it.
lib/markdownWriter.js
+
1
−
1
View file @
27dbafb1
...
...
@@ -113,7 +113,7 @@ function simpletype(prop) {
if
(
innertype
.
simpletype
===
'
complex
'
)
{
prop
.
simpletype
=
'
`array`
'
;
}
else
{
prop
.
simpletype
=
innertype
.
simpletype
.
replace
(
/
`
$/
,
'
[]
`
'
);
prop
.
simpletype
=
innertype
.
simpletype
.
replace
(
/
.
$/
,
'
$&
[]
'
);
}
console
.
log
();
}
else
{
...
...
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