Skip to content

Commit

Permalink
Merge pull request #25 from trimble-oss/fix-spectral
Browse files Browse the repository at this point in the history
Fixing package json
  • Loading branch information
jbend committed Aug 1, 2023
2 parents 1c2279d + 107c968 commit fd080fd
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 19 deletions.
29 changes: 22 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 11 additions & 12 deletions spectral.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
extends:
- [spectral:oas, all]
functionsDir: "./functions"
functions:
functions:
- valid-url-checker
- valid-version-checker
- is-a-plural-noun
Expand Down Expand Up @@ -39,8 +38,8 @@ rules:
then:
function: valid-version-checker

# Resource names in the URL must be a noun
# https://api-standards.trimble-pnp.com/api-standard/http#resource-naming
# Resource names in the URL must be a noun
# https://api-standards.trimble-pnp.com/api-standard/http#resource-naming
tas-api-paths-should-start-with-a-noun:
description: The root resource name in the URL MUST be a noun and MUST be in the plural form. Further nouns MAY be in the singular.
message: "{{error}}"
Expand All @@ -51,7 +50,7 @@ rules:
function: is-a-plural-noun

# All schema property names should be camel case.
# https://api-standards.trimble-pnp.com/api-standard/http#field-names
# https://api-standards.trimble-pnp.com/api-standard/http#field-names
tas-openapi-v3-schema-properties-names-camel-case:
description: Ensuring that schema property names are camel case.
message: All schema property names should be camel case.
Expand All @@ -61,9 +60,9 @@ rules:
field: "@key"
function: pattern
functionOptions:
match: "^[a-z][a-zA-Z0-9]*$"
match: "^[a-z][a-zA-Z0-9]*$"
errorMessage: All field names MUST be formatted as camel case.

# Resource path should not contain HTTP verbs
# https://api-standards.trimble-pnp.com/api-standard/http#avoiding-actions-in-resource-names
tas-no-http-verbs-in-path:
Expand All @@ -77,7 +76,7 @@ rules:
function: no-http-verbs-in-path

# All APIs returning structured data should support JSON as the default format
# https://api-standards.trimble-pnp.com/api-standard/http#data-from-apis-bodies-returned-from-gets-posts-puts
# https://api-standards.trimble-pnp.com/api-standard/http#data-from-apis-bodies-returned-from-gets-posts-puts
tas-structured-data-format:
description: All APIs returning structured data should support JSON as the default format.
severity: error
Expand All @@ -87,15 +86,15 @@ rules:
function: check-if-application-or-json-in-put-and-post-response

# All APIs returning structured data should support JSON as the default format.
# https://api-standards.trimble-pnp.com/api-standard/http#data-from-apis-bodies-returned-from-gets-posts-puts
# https://api-standards.trimble-pnp.com/api-standard/http#data-from-apis-bodies-returned-from-gets-posts-puts
tas-structured-data-format-support-json-response-body:
description: All APIs returning structured data should support JSON as the default format.
severity: error
message: "{{error}}"
given: "$.paths.*."
then:
function: check-if-response-body-json-in-get-response

# All APIs should return a valid http response code (Additional ruleset)
tdp-http-response-code:
description: All APIs should return a valid http response code.
Expand All @@ -117,7 +116,7 @@ rules:
field: "@key"
function: check-for-query-parameter-in-every-path

# Spec should contain only valid http verbs (Additional ruleset)
# Spec should contain only valid http verbs (Additional ruleset)
tdp-does-spec-contains-valid-http-verbs:
description: All APIs should have a valid http verb.
severity: warn
Expand All @@ -132,7 +131,7 @@ rules:
description: Spec should not be empty.
severity: error
message: "{{error}}"
given: '$'
given: "$"
then:
function: is-valid-spec

Expand Down

0 comments on commit fd080fd

Please sign in to comment.