Skip to content

Commit eab1e71

Browse files
authored
Merge pull request #65 from kuisathaverat/docs/no_value
docs: add particular use case to the modifiers docs
2 parents d9f083f + 02e3215 commit eab1e71

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,34 @@ Currently supported modifiers:
120120

121121
The modifiers are also customizable via the [configuration file](#configuration-file).
122122

123+
In case you are adding a `custom modifier` to a parameter that does not have value in the values file
124+
you must add one of the `supported modifiers` as last modifier.
125+
126+
Example:
127+
128+
Values file
129+
130+
```yaml
131+
# @param noDefaultValue [number, nullable] Description
132+
# noDefaultValue: 1
133+
```
134+
135+
Custom configuration snippet:
136+
137+
```json
138+
{
139+
...
140+
"modifiers": {
141+
"array": "array",
142+
"object": "object"
143+
"string": "string"
144+
"nullable": "nullable",
145+
"number": "number"
146+
},
147+
...
148+
}
149+
```
150+
123151
## Configuration file
124152

125153
The configuration file has the following structure:

lib/builder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function applyModifiers(param, config) {
3636
// modifier specifies the default value.
3737
break;
3838
default:
39-
throw new Error(`Unknown modifier: ${modifier}`);
39+
throw new Error(`Unknown modifier: ${modifier} for parameter ${param.name}`);
4040
}
4141
});
4242
}

0 commit comments

Comments
 (0)