Skip to content

Commit

Permalink
Merge pull request #35 from istreamlabs/noun-special-exception
Browse files Browse the repository at this point in the history
feat: add another specialized exception to noun
  • Loading branch information
iwong-isp authored Jun 27, 2023
2 parents a0350a2 + cf327f3 commit b4652a6
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,24 @@ It's also possible to set it to `warn` or `info`.

The `extends` field is automatically added (or appended to) by the linter script to inject the iSP ruleset into your config.

### Local Development

1. Install `node 13.14.0` locally.
2. Run `npm run build` to compile the `isp-functions`.
3. Run `node ./entrypoint.js <PATH_TO_OPENAPI_SPEC>` to run the linter.

The `build` command may need to be re-run to pick up changes made to some of the `isp-functions`.

#### Tests

```sh
# Compile the isp-functions
npm run build
# Run test
npm run test
```

## License

Copyright © 2020 iStreamPlanet Co., LLC
Expand Down
26 changes: 26 additions & 0 deletions fixtures/lint/noun-pass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,29 @@ paths:
responses:
'204':
description: Response description
/foos/{fooId}/bars/{barId}/preview/watch:
get:
summary: Test operation
description: Test operation description
operationId: test-preview
tags:
- Test
parameters:
- name: fooId
in: path
required: true
description: some parameter
schema:
type: string
pattern: /[a-z]+/
- name: barId
in: path
required: true
description: some parameter
schema:
type: string
pattern: /[a-z]+/
responses:
'204':
description: Response description

2 changes: 1 addition & 1 deletion isp-functions/noun-deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = targetValue => {
// Split into path pieces ignoring blank/empty ones and params.
let pieces = targetValue.split('/').filter(i => !!i);

if ((pieces.length === 1 && pieces[0] === 'search') || pieces[0] === 'me' || pieces[0] === 'cust') {
if ((pieces.length === 1 && pieces[0] === 'search') || pieces[0] === 'me' || pieces[0] === 'cust' || (pieces.length === 6 && pieces[4] === 'preview')) {
// Top-level exceptions. Skip.
return;
}
Expand Down

0 comments on commit b4652a6

Please sign in to comment.