Skip to content
Snippets Groups Projects
Commit f9c8ff87 authored by Lars Trieloff's avatar Lars Trieloff
Browse files

[trivial] better naming of referenced schemas

parent 5805cb4e
No related branches found
No related tags found
No related merge requests found
...@@ -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) | complex | Optional | Complex References (this schema) | | [refnamed](#refnamed) | Simple | 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: complex * type: Simple
* defined in this schema * defined in this schema
### refnamed Type ### refnamed Type
......
...@@ -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'] = {};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment