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

feat: add default resolvers #245

Merged
merged 26 commits into from
Jun 18, 2019
Merged

feat: add default resolvers #245

merged 26 commits into from
Jun 18, 2019

Conversation

marbemac
Copy link
Contributor

@marbemac marbemac commented Jun 4, 2019

fixes #134 #171

WIP - still needs tests and docs.

Please check if the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce?

Bug fix / kind of a feature?

If this is a feature change, what is the new behavior?

Will add description to readme.

Does this PR introduce a breaking change?

No.

Other information

dependabot-preview bot and others added 15 commits May 23, 2019 22:20
Bumps [@stoplight/types](https://github.com/stoplightio/types) from 5.1.2 to 7.0.1.
- [Release notes](https://github.com/stoplightio/types/releases)
- [Commits](stoplightio/types@v5.1.2...v7.0.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
Bumps [yaml](https://github.com/eemeli/yaml) from 1.5.1 to 1.6.0.
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](eemeli/yaml@v1.5.1...v1.6.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
* fix: handle ajv resolving issues

* feat: include resolver errors
Copy link
Contributor

@P0lip P0lip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's looking pretty slick so far!

We should also update type annotations for Resolver and related. At the moment we have any everywhere.

src/resolvers/http.ts Outdated Show resolved Hide resolved
src/spectral.ts Show resolved Hide resolved
@P0lip P0lip marked this pull request as ready for review June 4, 2019 09:23
P0lip
P0lip previously approved these changes Jun 4, 2019
Copy link
Contributor

@P0lip P0lip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go once docs are updated. Would also appreciate a note on authority. It's not quite obvious for me either.

package.json Outdated Show resolved Hide resolved
P0lip
P0lip previously approved these changes Jun 4, 2019
@marbemac
Copy link
Contributor Author

marbemac commented Jun 5, 2019

Alright we have a tricky question...

Should we report errors in $ref'd files? For example, in the below image the library.yaml file has an error (the example does not match the schema). one.yaml references the address model via $ref: '../library.yaml#/definitions/address'. If a user runs spectral on one.yaml, should the error in library.yaml be reported? If so, it brings up the tricky issue of how to report this error to the end user in a way that is not confusing (e.g. it should probably say its in a different file, with accurate line numbers relevant to that file, etc). This is non-trivial to do.

Screen Shot 2019-06-04 at 8 08 36 PM

@P0lip
Copy link
Contributor

P0lip commented Jun 5, 2019

@marbemac I think I've already asked you that question before and you said we wouldn't report such errors. Only errors relevant to linted files would be caught.

My question was about Studio and its diagnostics panel though.

@marbemac marbemac changed the base branch from master to develop June 18, 2019 00:28
@marbemac
Copy link
Contributor Author

Ok ready for another review. In answer to my question above, I think by default we just validate the provided file (not files that this file references). At a later date we could add an option to also validate $ref'd documents (would be off by default, so non breaking) - it will be tricky to get this UX right.

Copy link
Contributor

@P0lip P0lip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working fine!

@P0lip P0lip merged commit c1e0840 into develop Jun 18, 2019
@P0lip P0lip deleted the feat/remote-refs branch June 18, 2019 02:05
@philsturgeon
Copy link
Contributor

This didn’t update the README and after this discussion I’m not sure what actually changed. If we are not validating the contents of external refs then what are we doing?

@philsturgeon
Copy link
Contributor

@P0lip hey this still had "WIP - still needs tests and docs." on it, so we dont have tests, or docs. Could you maybe switch to doing this and put a pause on request maker?

@P0lip
Copy link
Contributor

P0lip commented Jun 18, 2019

@philsturgeon sure, will do

@marbemac
Copy link
Contributor Author

This didn’t update the README and after this discussion I’m not sure what actually changed. If we are not validating the contents of external refs then what are we doing?

We're resolving file and http(s) $refs now, and reporting an error if they cannot be resolved. See this comment for the "do we validate things that this file references" question: #245 (comment)

In general, that is a larger task and should probably be handled separately. It kind of changes an underlying assumption that we're validating one file at a time. We'll need to re-think how we track and report errors, since now errors (and their line numbers etc) can span across multiple files in a single spectral run.

cc @philsturgeon

const spectral = new Spectral();

let targetUri = name;
if (!startsWith(name, 'http')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@P0lip looks like if name is "httpModels/somefile.json" it will think it is a URL. Can we switch tohttp(s)://` regex in the test PR you are working on? #264

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@philsturgeon sure, I'll make that happen.

@philsturgeon
Copy link
Contributor

Ok we've made a CLI specific issue for this. Thank you!

philsturgeon pushed a commit that referenced this pull request Jun 28, 2019
BREAKING CHANGE: json-ref-resolver upgraded to 2.x

* fix: Bump @stoplight/types from 5.1.2 to 7.0.1 (#224)

Bumps [@stoplight/types](https://github.com/stoplightio/types) from 5.1.2 to 7.0.1.
- [Release notes](https://github.com/stoplightio/types/releases)
- [Commits](stoplightio/types@v5.1.2...v7.0.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* fix: upgrade ref resolver (#225)

* chore: Bump yaml from 1.5.1 to 1.6.0

Bumps [yaml](https://github.com/eemeli/yaml) from 1.5.1 to 1.6.0.
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](eemeli/yaml@v1.5.1...v1.6.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* fix: invalid-ref error (#228)

* fix: handle ajv resolving issues

* feat: include resolver errors

* chore: [Security] Bump tar from 2.2.1 to 2.2.2

Bumps [tar](https://github.com/npm/node-tar) from 2.2.1 to 2.2.2. **This update includes security fixes.**
- [Release notes](https://github.com/npm/node-tar/releases)
- [Commits](isaacs/node-tar@v2.2.1...v2.2.2)

* chore: Bump @types/node from 12.0.2 to 12.0.3

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.0.2 to 12.0.3.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

* chore: Bump typescript from 3.4.5 to 3.5.1

Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.4.5 to 3.5.1.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/commits)

* chore: Bump @stoplight/types from 7.0.1 to 7.1.0

Bumps [@stoplight/types](https://github.com/stoplightio/types) from 7.0.1 to 7.1.0.
- [Release notes](https://github.com/stoplightio/types/releases)
- [Commits](stoplightio/types@v7.0.1...v7.1.0)

* chore: Bump @oclif/command from 1.5.13 to 1.5.14

Bumps [@oclif/command](https://github.com/oclif/command) from 1.5.13 to 1.5.14.
- [Release notes](https://github.com/oclif/command/releases)
- [Changelog](https://github.com/oclif/command/blob/master/CHANGELOG.md)
- [Commits](oclif/command@v1.5.13...v1.5.14)

* chore: Bump @types/lodash from 4.14.130 to 4.14.133

Bumps [@types/lodash](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/lodash) from 4.14.130 to 4.14.133.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/lodash)

* feat: add default resolvers

* feat: support passing resolve option into run cmd

* test: fix them

* feat: resolve http and json refs in cli

* fix: use the resolved value in schema function

* fix: missing function call

* fix: use actual schema object

* test: update spectral.test.ts

* fix: do not try to resolve valid uris

* chore: rename authority to documentUri

* chore: use node-fetch

* fix: parse remote yaml in resolver

* chore: oops remove dummy fixture

* chore: use extname

* fix: resolve targetUri before run if its a file
XVincentX pushed a commit that referenced this pull request Jul 10, 2019
* chore: Bump @types/lodash from 4.14.133 to 4.14.134

Bumps [@types/lodash](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/lodash) from 4.14.133 to 4.14.134.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/lodash)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* chore: Bump ts-node from 8.1.0 to 8.3.0

Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 8.1.0 to 8.3.0.
- [Release notes](https://github.com/TypeStrong/ts-node/releases)
- [Commits](TypeStrong/ts-node@v8.1.0...v8.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* chore: Bump tslint from 5.16.0 to 5.17.0

Bumps [tslint](https://github.com/palantir/tslint) from 5.16.0 to 5.17.0.
- [Release notes](https://github.com/palantir/tslint/releases)
- [Changelog](https://github.com/palantir/tslint/blob/master/CHANGELOG.md)
- [Commits](palantir/tslint@5.16.0...5.17.0)

* chore: Bump @oclif/plugin-help from 2.1.6 to 2.2.0

Bumps [@oclif/plugin-help](https://github.com/oclif/plugin-help) from 2.1.6 to 2.2.0.
- [Release notes](https://github.com/oclif/plugin-help/releases)
- [Changelog](https://github.com/oclif/plugin-help/blob/master/CHANGELOG.md)
- [Commits](oclif/plugin-help@v2.1.6...v2.2.0)

* fix: Bump @stoplight/types from 5.1.2 to 7.0.1 (#224)

Bumps [@stoplight/types](https://github.com/stoplightio/types) from 5.1.2 to 7.0.1.
- [Release notes](https://github.com/stoplightio/types/releases)
- [Commits](stoplightio/types@v5.1.2...v7.0.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* fix: upgrade ref resolver (#225)

* chore: Bump yaml from 1.5.1 to 1.6.0

Bumps [yaml](https://github.com/eemeli/yaml) from 1.5.1 to 1.6.0.
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](eemeli/yaml@v1.5.1...v1.6.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* fix: invalid-ref error (#228)

* fix: handle ajv resolving issues

* feat: include resolver errors

* chore: [Security] Bump tar from 2.2.1 to 2.2.2

Bumps [tar](https://github.com/npm/node-tar) from 2.2.1 to 2.2.2. **This update includes security fixes.**
- [Release notes](https://github.com/npm/node-tar/releases)
- [Commits](isaacs/node-tar@v2.2.1...v2.2.2)

* chore: Bump @types/node from 12.0.2 to 12.0.3

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.0.2 to 12.0.3.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

* chore: Bump typescript from 3.4.5 to 3.5.1

Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.4.5 to 3.5.1.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/commits)

* chore: Bump @stoplight/types from 7.0.1 to 7.1.0

Bumps [@stoplight/types](https://github.com/stoplightio/types) from 7.0.1 to 7.1.0.
- [Release notes](https://github.com/stoplightio/types/releases)
- [Commits](stoplightio/types@v7.0.1...v7.1.0)

* fix: escape dot in example.com match pattern (#246)

* docs: update readme file SO-250

- fix the example of importing rules
- add repl.it examples
- move programmatic api docs to separate file
- clean up the readme a bit and update outputs

* chore: bump fs-extra (#252)

* chore: Bump @types/node from 12.0.3 to 12.0.7

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.0.3 to 12.0.7.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* fix(pattern.ts): enable use of regex flags for pattern in ruleset files (#251)

* fix(pattern.ts): enable use of regex flags for pattern in ruleset files

#242

* Update src/functions/pattern.ts

Co-Authored-By: Jakub Rożek <P0lip@users.noreply.github.com>

* Update src/functions/pattern.ts

Co-Authored-By: Jakub Rożek <P0lip@users.noreply.github.com>

* test(pattern.test.ts): testing exception on invalid flag in string regex

#242

* test(pattern.ts): use a different assertion

* feat: switch to more lightweight jsonpath pkg

BREAKING CHANGE: jsonpath-plus is now used for object querying. Syntax is slightly different in comparison to jsonpath.

* chore: defensive try/catch just in case

* chore: update how deps are pegged

* feat: implement quiet switch (#260)

* feat: remove maxResults flag

BREAKING CHANGE: maxResults is no longer available. Use max-results instead.

* chore: avoid accidental majors

* chore: Bump @stoplight/types from 5.1.2 to 9.0.2

Bumps [@stoplight/types](https://github.com/stoplightio/types) from 5.1.2 to 9.0.2.
- [Release notes](https://github.com/stoplightio/types/releases)
- [Commits](stoplightio/types@v5.1.2...v9.0.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* feat: add default resolvers  (#245)

BREAKING CHANGE: json-ref-resolver upgraded to 2.x

* fix: Bump @stoplight/types from 5.1.2 to 7.0.1 (#224)

Bumps [@stoplight/types](https://github.com/stoplightio/types) from 5.1.2 to 7.0.1.
- [Release notes](https://github.com/stoplightio/types/releases)
- [Commits](stoplightio/types@v5.1.2...v7.0.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* fix: upgrade ref resolver (#225)

* chore: Bump yaml from 1.5.1 to 1.6.0

Bumps [yaml](https://github.com/eemeli/yaml) from 1.5.1 to 1.6.0.
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](eemeli/yaml@v1.5.1...v1.6.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* fix: invalid-ref error (#228)

* fix: handle ajv resolving issues

* feat: include resolver errors

* chore: [Security] Bump tar from 2.2.1 to 2.2.2

Bumps [tar](https://github.com/npm/node-tar) from 2.2.1 to 2.2.2. **This update includes security fixes.**
- [Release notes](https://github.com/npm/node-tar/releases)
- [Commits](isaacs/node-tar@v2.2.1...v2.2.2)

* chore: Bump @types/node from 12.0.2 to 12.0.3

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.0.2 to 12.0.3.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

* chore: Bump typescript from 3.4.5 to 3.5.1

Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.4.5 to 3.5.1.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/commits)

* chore: Bump @stoplight/types from 7.0.1 to 7.1.0

Bumps [@stoplight/types](https://github.com/stoplightio/types) from 7.0.1 to 7.1.0.
- [Release notes](https://github.com/stoplightio/types/releases)
- [Commits](stoplightio/types@v7.0.1...v7.1.0)

* chore: Bump @oclif/command from 1.5.13 to 1.5.14

Bumps [@oclif/command](https://github.com/oclif/command) from 1.5.13 to 1.5.14.
- [Release notes](https://github.com/oclif/command/releases)
- [Changelog](https://github.com/oclif/command/blob/master/CHANGELOG.md)
- [Commits](oclif/command@v1.5.13...v1.5.14)

* chore: Bump @types/lodash from 4.14.130 to 4.14.133

Bumps [@types/lodash](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/lodash) from 4.14.130 to 4.14.133.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/lodash)

* feat: add default resolvers

* feat: support passing resolve option into run cmd

* test: fix them

* feat: resolve http and json refs in cli

* fix: use the resolved value in schema function

* fix: missing function call

* fix: use actual schema object

* test: update spectral.test.ts

* fix: do not try to resolve valid uris

* chore: rename authority to documentUri

* chore: use node-fetch

* fix: parse remote yaml in resolver

* chore: oops remove dummy fixture

* chore: use extname

* fix: resolve targetUri before run if its a file

* chore: Bump jest-when from 2.4.0 to 2.6.0

Bumps [jest-when](https://github.com/timkindberg/jest-when) from 2.4.0 to 2.6.0.
- [Release notes](https://github.com/timkindberg/jest-when/releases)
- [Commits](https://github.com/timkindberg/jest-when/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* chore: Bump @types/node from 12.0.8 to 12.0.10

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.0.8 to 12.0.10.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* docs: config file (#270)

* docs: config file

* docs: added link to config on README

* chore: Bump @oclif/command from 1.5.14 to 1.5.15

Bumps [@oclif/command](https://github.com/oclif/command) from 1.5.14 to 1.5.15.
- [Release notes](https://github.com/oclif/command/releases)
- [Changelog](https://github.com/oclif/command/blob/master/CHANGELOG.md)
- [Commits](oclif/command@v1.5.14...v1.5.15)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* chore: Bump tslint from 5.17.0 to 5.18.0

Bumps [tslint](https://github.com/palantir/tslint) from 5.17.0 to 5.18.0.
- [Release notes](https://github.com/palantir/tslint/releases)
- [Changelog](https://github.com/palantir/tslint/blob/master/CHANGELOG.md)
- [Commits](palantir/tslint@5.17.0...5.18.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* add quiet flag to readme (#273)

* chore: Upload artifacts on release (#274)

* chore: add install sh script

* chore: upload artifacts

* feat: use latest openapi v3.0 metaschema (#275)

* Release only when a tag is published (#277)

* Update config.yml

* chore: remove spaces

* feat: incorporate better-ajv-errors (#265)

* feat: incorporate better-ajv-errors

* feat: strip property name from error message

* chore: add a comment

* test: extra ajv integration test

* test: remove redundant test case

* chore: Bump @semantic-release/exec from 3.3.3 to 3.3.5

Bumps [@semantic-release/exec](https://github.com/semantic-release/exec) from 3.3.3 to 3.3.5.
- [Release notes](https://github.com/semantic-release/exec/releases)
- [Commits](semantic-release/exec@v3.3.3...v3.3.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* chore: Bump @types/lodash from 4.14.134 to 4.14.135

Bumps [@types/lodash](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/lodash) from 4.14.134 to 4.14.135.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/lodash)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* chore: Bump @stoplight/json-ref-resolver from 2.0.0 to 2.0.1

Bumps [@stoplight/json-ref-resolver](https://github.com/stoplightio/json-ref-resolver) from 2.0.0 to 2.0.1.
- [Release notes](https://github.com/stoplightio/json-ref-resolver/releases)
- [Commits](stoplightio/json-ref-resolver@v2.0.0...v2.0.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* feat: process referenced files (#271)

* refactor: drop resolved

* feat: implement Resolved

* feat: wip

* feat: wip #2

* fix: include src in json validation message

* fix: feedback from Phil on http

* test: ref resolving

* refactor: naming + improved SpectralResolver

* fix: typing

* chore: remove yalced json-ref-resolver

* refactor: drop SpectralResolver

* fix: restore property path

* test: ajv error path

* test: extra ajv error path asserition

* refactor: sort out imports

* chore: Bump fs-extra from 8.0.1 to 8.1.0

Bumps [fs-extra](https://github.com/jprichardson/node-fs-extra) from 8.0.1 to 8.1.0.
- [Release notes](https://github.com/jprichardson/node-fs-extra/releases)
- [Changelog](https://github.com/jprichardson/node-fs-extra/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jprichardson/node-fs-extra/commits/8.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* feat(rulesets): renamed enabled to recommended (#285)

This is a breaking change which right now doesnt really do anything, but will let us add more useful
functionality in following versions. We want to support extending rulesets and taking either the
recom

BREAKING CHANGE: if you were using enabled: true/false change it to recommended: true/false

* release: fixes (#289)

* docs: run release only on tags

* feat: add dockerfile

* chore: release fixes

* fix: path to binaries

* chore: do not run on branches

* feat: get package version from git tag

* fix: other things

* chore: put npm token

* docs: offer the install script

* Update .gitignore

Co-Authored-By: Jakub Rożek <P0lip@users.noreply.github.com>

* chore: deduplicate tsconfig so I can remove a gazilion of dependencies

* chore: restore ts-jest

* fix: detect version number before creating the binary (#290)

* fix: gh_token

* fix: last minute stuff

* feat: docker image publishing (#291)

* feat: different ruleset extending (#232)

* feat: different ruleset extending

* feat: another take

* feat: refine ruleset validator

* refactor: fs reader is fully async now

* refactor: change extending

* refactor: resolvePath supports built-in Spectral files

* revert: runner.ts change

* revert: lint.ts

* refactor: drop util.promisify

* feat: use @stoplight/path

* refactor: rename rulests + support shorthands

* feat: use stoplight/path#isURL

* feat: human-readable severity levels

* refactor: introduce resolver

* feat: config merger

* feat: merge array-ish syntax

* feat: improve resolver & blend everything together

* revert: restore ruleset validation messages

* test: cover new resolving capabilities

* feat: nuke config files

* feat: tweak merger

* feat: improve ruleset validator

* fix: throw if rule cannot be processed

* feat: supports array-ish extends

* fix: slight adjustments to merger/reader & tests

* chore: naming tweak in linter.test and rule schema

* test: cover all rulesets shorthands

* chore: improve config.ts

* refactor(merger): shallow merging

* chore: rename ruleset resolver to ruleset finder

* refactor: include disabled rules

* feat: set default severity to warn

* chore(merger): use ruleset keyword

* test: rename fixtures

* fix: tests

* refactor: rename rule file

* refactor: correctly use tslint to fix

* fix: add bin directory (#292)

* chore: quote so that works on zsh

* fix: include bin directory

* fix: all the conditions

* fix: rename rules.json to index.json (#294)

* feat: rename rules.json to index.json

* build(jest-config): exclude json from moduleFileExtensions

* test: nuke snapshots (#296)

* test: nuke all the snapshots 🔥

* test: drop toMatchInlineSnapshot

* Adding in templates for story and task (#293)

* Adding in templates for story and task

* Moving templates into ISSUE_TEMPLATE folder

* updating templates for consistency

* ci: update issue templates and pr template

* issue templates

* feat: remove deprecated IRule & IRuleResult summary property (#297)

BREAKING CHANGE: summary property was removed - use message property instead.

* feat: remove deprecated IRule & IRuleResult summary property

* docs: remove summary property

* chore: typo

* fix: rule with human-readable severity should be considered as valid (#298)

* fix: rule with human-readable severity should be considered as valid

* fix: support rule: [DiagnosticSeverity, <object>] case

* refactor: unify config and ruleset naming (#300)

* refactor: unify config and ruleset naming

* docs: remove config

* docs: say a word about browsers

* Create azure-pipelines.yml (#334)

* Create azure-pipelines.yml

* refactor: use one command

* fix: use our fork of better-ajv-errors (#336)

* fix: use our fork of better-ajv-errors

* chore: avoid github.com

* test: run tests on develop branch (#337)

test: run tests on develop branch

* test: run Spectral tests in browser on CI (#284)

* build: basic Jest setup for electron testing

* build: configure Karma test runner

* build: improve Karma setup & update linter.test.ts

* chore: stub snapshot assertions

* build: tweak karma-jest.ts

* fix: use undefined rather than void to satisify karma-typescript

* build: ignore cli tests for Electron runner

* chore: some tweaks

* chore: drop electron runner

* chore: disable snapshot assertions

* test: karma.test.ts & jest.test.ts

* revert: test -> it in function.test.ts

* revert: remove unused deps

* fix: better handling of recommended rules

* build(jest): do not collect coverage from dist/

* test(finder): unpkg

* chore: add test variant docker images

* chore: reuse our tsconfig build

* chore: regular JSON

* chore: be more clear about what's going on

* chore: add status for develop branch

* chore: add circleci status badge

* test(karma): proper snapshot message

* chore: rename loader.test.ts

* test: remove empty file

* test: skip (#338)

* chore: Bump ajv from 6.10.0 to 6.10.1 (#339)

Bumps [ajv](https://github.com/epoberezkin/ajv) from 6.10.0 to 6.10.1.
- [Release notes](https://github.com/epoberezkin/ajv/releases)
- [Commits](ajv-validator/ajv@v6.10.0...v6.10.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* feat: offload docker image creation to dockerhub (#343)

* chore: offload docker image creation to dockerhub

* docs: remove tick

* feat(cli): remove --max-results flag (#345)

BREAKING CHANGE: --max-results flag is gone.

* test(lint): revert previous assertion (#346)

* chore: Bump @types/node from 12.0.10 to 12.6.0

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.0.10 to 12.6.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* chore: Bump lint-staged from 9.0.2 to 9.1.0

Bumps [lint-staged](https://github.com/okonet/lint-staged) from 9.0.2 to 9.1.0.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](lint-staged/lint-staged@v9.0.2...v9.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* feat: include recomended rules by default (#301)

* chore: bump @stoplight/types

* feat: normalize severity in merger

* feat(severity): better handling of rare edge case

* fix(merger): severity should be respected

* test(validation): two extra scenarios

* feat: inherit ruleset severity

* fix: inherit severity properly

* chore(reader): better explanation

* chore: rename test case

* test: cover all - off case

* revert: hasOwnProperty change

* test(merger): cover non-ideal data case

* chore: remove dead code

* fix(ruleset): accept string as extends value

* chore: rename merger.unit.ts

* Merge latest master in develop (#348)

* fix: Bump @stoplight/types from 5.1.2 to 7.0.1 (#224)

Bumps [@stoplight/types](https://github.com/stoplightio/types) from 5.1.2 to 7.0.1.
- [Release notes](https://github.com/stoplightio/types/releases)
- [Commits](stoplightio/types@v5.1.2...v7.0.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* fix: upgrade ref resolver (#225)

* chore: Bump yaml from 1.5.1 to 1.6.0

Bumps [yaml](https://github.com/eemeli/yaml) from 1.5.1 to 1.6.0.
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](eemeli/yaml@v1.5.1...v1.6.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* fix: invalid-ref error (#228)

* fix: handle ajv resolving issues

* feat: include resolver errors

* chore: [Security] Bump tar from 2.2.1 to 2.2.2

Bumps [tar](https://github.com/npm/node-tar) from 2.2.1 to 2.2.2. **This update includes security fixes.**
- [Release notes](https://github.com/npm/node-tar/releases)
- [Commits](isaacs/node-tar@v2.2.1...v2.2.2)

* chore: Bump @types/node from 12.0.2 to 12.0.3

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.0.2 to 12.0.3.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

* chore: Bump typescript from 3.4.5 to 3.5.1

Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.4.5 to 3.5.1.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/commits)

* chore: Bump @stoplight/types from 7.0.1 to 7.1.0

Bumps [@stoplight/types](https://github.com/stoplightio/types) from 7.0.1 to 7.1.0.
- [Release notes](https://github.com/stoplightio/types/releases)
- [Commits](stoplightio/types@v7.0.1...v7.1.0)

* chore: Bump @oclif/command from 1.5.13 to 1.5.14

Bumps [@oclif/command](https://github.com/oclif/command) from 1.5.13 to 1.5.14.
- [Release notes](https://github.com/oclif/command/releases)
- [Changelog](https://github.com/oclif/command/blob/master/CHANGELOG.md)
- [Commits](oclif/command@v1.5.13...v1.5.14)

* chore: Bump @types/lodash from 4.14.130 to 4.14.133

Bumps [@types/lodash](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/lodash) from 4.14.130 to 4.14.133.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/lodash)

* fix: escape dot in example.com match pattern (#246)

* docs: update readme file SO-250

- fix the example of importing rules
- add repl.it examples
- move programmatic api docs to separate file
- clean up the readme a bit and update outputs

* chore: bump fs-extra (#252)

* chore: Bump @types/node from 12.0.3 to 12.0.7

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.0.3 to 12.0.7.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* fix(pattern.ts): enable use of regex flags for pattern in ruleset files (#251)

* fix(pattern.ts): enable use of regex flags for pattern in ruleset files

#242

* Update src/functions/pattern.ts

Co-Authored-By: Jakub Rożek <P0lip@users.noreply.github.com>

* Update src/functions/pattern.ts

Co-Authored-By: Jakub Rożek <P0lip@users.noreply.github.com>

* test(pattern.test.ts): testing exception on invalid flag in string regex

#242

* test(pattern.ts): use a different assertion

* feat: implement quiet switch (#260)

* docs: SVG for the readme and a quick go at cli (#299)

* docs: very wip readme update

* docs: cli docs

* docs: add some ruleset examples

* docs: minor changes

* docs: comment out what we need to do next

* docs: more small changes

* docs: list hint

* docs: fix docker command

* docs: fixes

* docs: pronoun

* fix: copy rulesets to main directory (#352)

* refactor: build in same dir

* refactor: do not require dist

* chore: duplicate rulestes

* fix: remove file

* build: inline pkg version (#353)

* build: inline pkg version

* feat(inliner): cast to string

* refactor(severity): reduce complexity

* refactor(finder): reduce complexity

* refactor(severity): reduce complexity

* refactor(finder): reduce complexity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add optional support for external $ref in CLI
5 participants