-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #129 from stoplightio/custom-rulesets
feat: custom rulesets
- Loading branch information
Showing
16 changed files
with
325 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
extends: spectral:oas | ||
|
||
except: | ||
'fixtures/test.oas.yml#/paths/~1todos/get': | ||
- operation-description | ||
|
||
'fixtures/non_existent.yml#': | ||
- oas3-api-servers | ||
- openapi-tags | ||
|
||
'fixtures/non_existent.yml#/info': | ||
- info-contact | ||
|
||
'fixtures/non_existent.yml#/paths/~1todos/get': | ||
- operation-description |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=827846 | ||
// for the documentation about the extensions.json format | ||
"recommendations": ["editorconfig.editorconfig"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,34 @@ | ||
FROM node:13 as builder | ||
FROM node:12 as builder | ||
|
||
COPY package* ./ | ||
COPY package.json yarn.lock ./ | ||
RUN yarn | ||
|
||
COPY src ./src | ||
COPY tsconfig.json tsconfig.json | ||
|
||
RUN ./node_modules/.bin/tsc || true | ||
RUN yarn | ||
RUN yarn build || true | ||
|
||
############################################################### | ||
|
||
FROM node:13 as installer | ||
FROM node:12 as dependencies | ||
|
||
ENV NODE_ENV production | ||
COPY package.json package.json | ||
COPY package.json yarn.lock ./ | ||
RUN yarn --production | ||
|
||
FROM node:13-alpine as runtime | ||
RUN curl -sfL https://install.goreleaser.com/github.com/tj/node-prune.sh | bash | ||
RUN ./bin/node-prune | ||
|
||
############################################################### | ||
|
||
FROM node:12-alpine as runtime | ||
|
||
ENV NODE_ENV production | ||
|
||
COPY package.json /action/package.json | ||
|
||
COPY --from=builder dist /action/dist | ||
COPY --from=installer node_modules /action/node_modules | ||
COPY --from=dependencies node_modules /action/node_modules | ||
|
||
ENTRYPOINT ["node", "/action/dist/index.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,38 @@ | ||
# Spectral Lint Action | ||
# Spectral Linter Action | ||
|
||
![](https://raw.githubusercontent.com/stoplightio/spectral/master/img/spectral-banner.png) | ||
|
||
This action uses [Spectral 4.x](https://github.com/stoplightio/spectral) to lint your OpenAPI files. | ||
This action uses [Spectral](https://github.com/stoplightio/spectral) from [Stoplight](https://stoplight.io/) to lint your OpenAPI documents, or any other JSON/YAML files. | ||
|
||
![](./image.png) | ||
|
||
## Usage | ||
|
||
See [action.yml](action.yml) | ||
|
||
```yaml | ||
name: Run Spectral on Pull Requests | ||
|
||
on: | ||
- pull_request | ||
|
||
jobs: | ||
build: | ||
name: Run Spectral | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Check out the repository | ||
- uses: actions/checkout@v2 | ||
|
||
# Run Spectral | ||
- uses: stoplightio/[email protected] | ||
with: | ||
file_glob: 'doc/api/*.yaml' | ||
``` | ||
### Inputs | ||
- **file_glob:** Pattern describing the set of files to lint. Defaults to `*.oas.{json,yml,yaml}`. (_Note:_ Pattern syntax is documented in the [fast-glob](https://www.npmjs.com/package/fast-glob) package documentation) | ||
- **spectral_ruleset:** Custom ruleset to load in Spectral. When unspecified, will try to load the default `.spectral.yaml` ruleset if it exists; otherwise, the default built-in Spectral rulesets will be loaded. | ||
|
||
## Configuration | ||
|
||
Spectral Action will respect your [Spectral Rulesets](https://stoplight.io/p/docs/gh/stoplightio/spectral/docs/getting-started/rulesets.md), which can be defined, extended, and overriden by placing `.spectral.yml` in the root of your repository. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.{ts,yaml,yml,json,md}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.