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
f9c8ff87
Commit
f9c8ff87
authored
7 years ago
by
Lars Trieloff
Browse files
Options
Downloads
Patches
Plain Diff
[trivial] better naming of referenced schemas
parent
5805cb4e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/docs/complex.schema.md
+2
-2
2 additions, 2 deletions
examples/docs/complex.schema.md
lib/markdownWriter.js
+7
-1
7 additions, 1 deletion
lib/markdownWriter.js
with
9 additions
and
3 deletions
examples/docs/complex.schema.md
+
2
−
2
View file @
f9c8ff87
...
@@ -26,7 +26,7 @@ This is an example schema that uses types defined in other schemas.
...
@@ -26,7 +26,7 @@ This is an example schema that uses types defined in other schemas.
| Property | Type | Required | Defined by |
| Property | Type | Required | Defined by |
|----------|------|----------|------------|
|----------|------|----------|------------|
|
[
refabstract
](
#refabstract
)
| complex |
**Required**
| Complex References (this schema) |
|
[
refabstract
](
#refabstract
)
| complex |
**Required**
| Complex References (this schema) |
|
[
refnamed
](
#refnamed
)
|
co
mple
x
| Optional | Complex References (this schema) |
|
[
refnamed
](
#refnamed
)
|
Si
mple | Optional | Complex References (this schema) |
## refabstract
## refabstract
...
@@ -64,7 +64,7 @@ Unknown type ``.
...
@@ -64,7 +64,7 @@ Unknown type ``.
`
refnamed
`
`
refnamed
`
* is optional
* is optional
* type:
co
mple
x
* type:
Si
mple
* defined in this schema
* defined in this schema
### refnamed Type
### refnamed Type
...
...
This diff is collapsed.
Click to expand it.
lib/markdownWriter.js
+
7
−
1
View file @
f9c8ff87
...
@@ -76,9 +76,15 @@ function stringifyExamples(examples) {
...
@@ -76,9 +76,15 @@ function stringifyExamples(examples) {
}
}
}
}
/**
* Finds a simple, one-line description of the property's type
* @param {object} prop - a JSON Schema property definition
*/
function
simpletype
(
prop
)
{
function
simpletype
(
prop
)
{
const
type
=
prop
.
type
;
const
type
=
prop
.
type
;
if
(
prop
.
enum
!==
undefined
)
{
if
(
prop
.
$ref
!==
undefined
)
{
prop
.
simpletype
=
prop
.
$linkVal
;
}
else
if
(
prop
.
enum
!==
undefined
)
{
prop
.
simpletype
=
'
`enum`
'
;
prop
.
simpletype
=
'
`enum`
'
;
if
(
prop
[
'
meta:enum
'
]
===
undefined
)
{
if
(
prop
[
'
meta:enum
'
]
===
undefined
)
{
prop
[
'
meta:enum
'
]
=
{};
prop
[
'
meta:enum
'
]
=
{};
...
...
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