Skip to content

Commit

Permalink
Merge pull request #35 from hennihaus/spectral
Browse files Browse the repository at this point in the history
Added spectral
  • Loading branch information
hennihaus committed Apr 7, 2023
2 parents ea3c25a + 2b92838 commit af170ac
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on: [push]
jobs:
build:
runs-on: ubuntu-latest
permissions:
checks: write
steps:
- uses: actions/checkout@v3

Expand All @@ -17,6 +19,12 @@ jobs:
java-version: '11'
cache: 'gradle'

- name: Lint API
uses: stoplightio/spectral-action@v0.8.10
with:
file_glob: 'docs/credit.json'
spectral_ruleset: 'config/spectral/.spectral.json'

- name: Build with Gradle
run: ./gradlew build --no-daemon
env:
Expand Down
76 changes: 76 additions & 0 deletions config/spectral/.spectral.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"extends": [
[
"spectral:oas",
"all"
]
],
"formats": [
"oas3"
],
"rules": {
"contact-properties": {
"description": "Contact object must have 'name', 'url' and 'email'.",
"recommended": false,
"given": "$.info.contact",
"then": [
{
"field": "name",
"function": "truthy"
},
{
"field": "email",
"function": "truthy"
}
]
},
"duplicated-entry-in-enum": "error",
"info-contact": "error",
"info-description": "error",
"info-license": "error",
"license-url": "error",
"no-$ref-siblings": "error",
"no-eval-in-markdown": "error",
"no-script-tags-in-markdown": "error",
"openapi-tags": "error",
"openapi-tags-alphabetical": "error",
"openapi-tags-uniqueness": "error",
"operation-description": "off",
"operation-operationId": "error",
"operation-operationId-unique": "error",
"operation-operationId-valid-in-url": "error",
"operation-parameters": "error",
"operation-singular-tag": "error",
"operation-success-response": "error",
"operation-tags": "error",
"operation-tag-defined": "error",
"path-declarations-must-exist": "error",
"path-keys-no-trailing-slash": "error",
"path-not-include-query": "error",
"path-params": "error",
"tag-description": "off",
"typed-enum": "error",
"oas3-api-servers": "error",
"oas3-examples-value-or-externalValue": "error",
"oas3-operation-security-defined": "error",
"oas3-parameter-description": "error",
"oas3-schema": "error",
"oas3-server-not-example.com": "error",
"oas3-server-trailing-slash": "error",
"oas3-unused-component": "error",
"oas3-valid-media-example": "error",
"oas3-valid-schema-example": "error"
},
"overrides": [
{
"files": [
"credit.json#/components/parameters/amountInEuros/example",
"credit.json#/components/parameters/termInMonths/example",
"credit.json#/components/parameters/delayInMilliseconds/example"
],
"rules": {
"oas3-valid-media-example": "off"
}
}
]
}

0 comments on commit af170ac

Please sign in to comment.