Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add particular use case to the modifiers docs #65

Merged
merged 3 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,34 @@ Currently supported modifiers:

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

In case you are adding a `custom modifier` to a parameter that does not have value in the values file
you must add one of the `supported modifiers` as last modifier.

Example:

Values file

```yaml
# @param noDefaultValue [number, nullable] Description
# noDefaultValue: 1
```

Custom configuration snippet:

```json
{
...
"modifiers": {
"array": "array",
"object": "object"
"string": "string"
"nullable": "nullable",
"number": "number"
},
...
}
```

## Configuration file

The configuration file has the following structure:
Expand Down
2 changes: 1 addition & 1 deletion lib/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function applyModifiers(param, config) {
// modifier specifies the default value.
break;
default:
throw new Error(`Unknown modifier: ${modifier}`);
throw new Error(`Unknown modifier: ${modifier} for parameter ${param.name}`);
}
});
}
Expand Down