Skip to content
Snippets Groups Projects
Unverified Commit f5df0bfd authored by Lars Trieloff's avatar Lars Trieloff Committed by GitHub
Browse files

Merge pull request #70 from AndyOGo/bugfix/nested-enums-not-visible

provide simpletype to ejs templates for reuse at nested props
parents 34f86069 4ee80659
No related branches found
No related tags found
No related merge requests found
......@@ -150,7 +150,7 @@ This is not foo.
`nonfoo`
* is optional
* type: `boolean`
* type: `const`
The value of this property **must** be equal to:
......
......@@ -20,6 +20,7 @@ This is an example schema with examples for properties with enum values
| Property | Type | Required | Defined by |
|----------|------|----------|------------|
| [hello](#hello) | `enum` | **Required** | Enumerated (this schema) |
| [nested](#nested) | `object` | Optional | Enumerated (this schema) |
| `*` | any | Additional | this schema *allows* additional properties |
## hello
......@@ -41,3 +42,50 @@ The value of this property **must** be equal to one of the [known values below](
## nested
### Enumerated (Nested)
This is an example schema with examples for properties of nested objects with enum values
`nested`
* is optional
* type: `object`
* defined in this schema
### nested Type
`object` with following properties:
| Property | Type | Required |
|----------|------|----------|
| `test`| string | Optional |
#### test
A simple string. Pick a value.
`test`
* is optional
* type: `enum`
The value of this property **must** be equal to one of the [known values below](#nested-known-values).
##### test Known Values
| Value | Description |
|-------|-------------|
| `nested` | |
| `object` | |
| `works` | |
......@@ -18,6 +18,22 @@
"Welt"
],
"description": "A simple string. Pick a value."
},
"nested": {
"title": "Enumerated (Nested)",
"description": "This is an example schema with examples for properties of nested objects with enum values",
"type": "object",
"properties": {
"test": {
"type": "string",
"enum": [
"nested",
"object",
"works"
],
"description": "A simple string. Pick a value."
}
}
}
},
"required": [
......
......@@ -15,6 +15,19 @@
"type": "string",
"enum": ["World", "Welt"],
"description": "A simple string. Pick a value."
},
"nested": {
"title": "Enumerated (Nested)",
"description": "This is an example schema with examples for properties of nested objects with enum values",
"type": "object",
"properties": {
"test": {
"type": "string",
"enum": ["nested", "object", "works"],
"description": "A simple string. Pick a value."
}
}
}
},
"required": [
......
......@@ -243,7 +243,7 @@ const generateMarkdown = function(filename, schema, schemaPath, outDir, dependen
multi = multi.map(([ template, context ]) => {
return [
path.join(__dirname, '../templates/md/' + template),
assoc(context, '_', _)
assoc(assoc(context, '_', _), 'simpletype', simpletype)
];
});
......
......@@ -150,7 +150,7 @@ This is not foo.
`nonfoo`
* is optional
* type: `boolean`
* type: `const`
The value of this property **must** be equal to:
......
......@@ -20,6 +20,7 @@ This is an example schema with examples for properties with enum values
| Property | Type | Required | Defined by |
|----------|------|----------|------------|
| [hello](#hello) | `enum` | **Required** | Enumerated (this schema) |
| [nested](#nested) | `object` | Optional | Enumerated (this schema) |
| `*` | any | Additional | this schema *allows* additional properties |
## hello
......@@ -41,3 +42,50 @@ The value of this property **must** be equal to one of the [known values below](
## nested
### Enumerated (Nested)
This is an example schema with examples for properties of nested objects with enum values
`nested`
* is optional
* type: `object`
* defined in this schema
### nested Type
`object` with following properties:
| Property | Type | Required |
|----------|------|----------|
| `test`| string | Optional |
#### test
A simple string. Pick a value.
`test`
* is optional
* type: `enum`
The value of this property **must** be equal to one of the [known values below](#nested-known-values).
##### test Known Values
| Value | Description |
|-------|-------------|
| `nested` | |
| `object` | |
| `works` | |
......@@ -11,7 +11,7 @@
<% _.keys(schema.properties).sort().forEach(property => {
const inner = schema.properties[property];
inner.simpletype = "`" + inner.type + "`";
simpletype(inner)
const required = (Array.isArray(schema.required)&&schema.required.indexOf(property)>=0); %>
<%- include("nested-property",{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment