-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2683520
commit b8b985b
Showing
18 changed files
with
195 additions
and
2 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,6 @@ | ||
extends: ["spectral:oas"] | ||
|
||
rules: | ||
oas3-unused-component: false | ||
operation-operationId: false | ||
info-contact: false |
Empty file.
24 changes: 24 additions & 0 deletions
24
.template/addons/docs/openapi/examples/responses/health.json
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,24 @@ | ||
{ | ||
"ok": { | ||
"value": { | ||
"data": { | ||
"id": "1", | ||
"type": "health", | ||
"attributes": { | ||
"message": "OK" | ||
} | ||
} | ||
} | ||
}, | ||
"error": { | ||
"value": { | ||
"errors": [ | ||
{ | ||
"status": "500", | ||
"title": "Internal Server Error", | ||
"detail": "Something went wrong." | ||
} | ||
] | ||
} | ||
} | ||
} |
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,31 @@ | ||
--- | ||
openapi: 3.0.0 | ||
info: | ||
title: API Documentation | ||
description: This is the API documentation for the mock server. | ||
version: 1.0.0 | ||
|
||
servers: | ||
- url: http://localhost:8080/api/v1 | ||
description: Development Base URL | ||
|
||
security: | ||
- BearerAuth: [] | ||
|
||
components: | ||
securitySchemes: | ||
BearerAuth: | ||
type: http | ||
scheme: bearer | ||
schemas: | ||
$ref: "schemas.yml" | ||
responses: | ||
$ref: "responses.yml" | ||
|
||
paths: | ||
/health: | ||
$ref: "paths/health.yml" | ||
|
||
tags: | ||
- name: Status | ||
description: Status APIs of the project |
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,20 @@ | ||
--- | ||
get: | ||
tags: | ||
- Status | ||
security: [] | ||
summary: Get the status of the application. | ||
description: Call this API to get the status of the application. | ||
|
||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '../schemas.yml#/responses_health' | ||
examples: | ||
$ref: '../examples/responses/health.json' | ||
|
||
default: | ||
$ref: '../responses.yml#/responses_default_error' |
Empty file.
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,3 @@ | ||
--- | ||
responses_default_error: | ||
$ref: "responses/default_error.yml" |
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,11 @@ | ||
--- | ||
description: Default Error | ||
|
||
content: | ||
application/json: | ||
schema: | ||
$ref: '../schemas.yml#/error' | ||
example: | ||
errors: | ||
- code: 'invalid_request' | ||
detail: 'The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.' |
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,12 @@ | ||
--- | ||
#### REQUESTS #### | ||
|
||
#### RESPONSES #### | ||
|
||
responses_health: | ||
$ref: "schemas/responses/health.yml" | ||
|
||
#### REUSABLE SCHEMAS #### | ||
|
||
error: | ||
$ref: "schemas/shared/error.yml" |
Empty file.
24 changes: 24 additions & 0 deletions
24
.template/addons/docs/openapi/schemas/responses/health.yml
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,24 @@ | ||
--- | ||
type: object | ||
|
||
description: A response body for the health API | ||
|
||
properties: | ||
data: | ||
type: object | ||
description: The data object | ||
properties: | ||
id: | ||
type: string | ||
description: The identifier of the health | ||
example: "123" | ||
type: | ||
type: string | ||
description: The type of the health | ||
example: 'health' | ||
attributes: | ||
type: object | ||
properties: | ||
message: | ||
type: string | ||
description: The message description of the status |
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 @@ | ||
type: object | ||
|
||
properties: | ||
errors: | ||
type: array | ||
maxItems: 10 | ||
items: | ||
type: object | ||
properties: | ||
code: | ||
type: string | ||
description: an application-specific error code | ||
detail: | ||
type: string | ||
description: "a human-readable explanation specific to this occurrence of the problem. Like title, this field's value can be localized." |
31 changes: 31 additions & 0 deletions
31
.template/addons/github/.github/workflows/lint_docs.yml.tt
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,31 @@ | ||
name: Lint OpenAPI docs | ||
|
||
on: pull_request | ||
|
||
concurrency: | ||
group: {{ "${{ github.workflow }}-${{ github.ref }}" }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
docs_lint: | ||
name: Run lint for API docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up node and restore cached dependencies | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18.x" | ||
cache: npm | ||
cache-dependency-path: package-lock.json | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Generate API docs | ||
run: npm run build:docs | ||
|
||
- name: Run API docs linters | ||
run: npm run lint:docs:public |
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 |
---|---|---|
|
@@ -32,6 +32,9 @@ | |
run 'yarn add --dev stylelint' | ||
run 'yarn add --dev @nimblehq/[email protected]' | ||
run 'yarn add --dev @nimblehq/[email protected]' | ||
run 'yarn add --dev @apidevtools/[email protected]' | ||
run 'yarn add --dev @stoplight/[email protected]' | ||
run 'yarn add --dev [email protected]' | ||
|
||
# Setup scripts | ||
run 'npm pkg set scripts.eslint="eslint . --color"' | ||
|
@@ -40,6 +43,11 @@ | |
run 'npm pkg set scripts.stylelint:fix="stylelint **/*.scss --color --fix"' | ||
run 'npm pkg set scripts.codebase="yarn eslint && yarn stylelint"' | ||
run 'npm pkg set scripts.codebase:fix="yarn eslint:fix && yarn stylelint:fix"' | ||
run 'npm pkg set scripts.lint:docs:yml="eslint docs/openapi --ext .yml --color"' | ||
run 'npm pkg set scripts.lint:docs:openapi="spectral lint docs/openapi/openapi.yml -F error"' | ||
run 'npm pkg set scripts.lint:docs:dev="npm lint:docs:yml && npm lint:docs:openapi"' | ||
run 'npm pkg set scripts.lint:docs:public="npm build:docs && eslint public/openapi.yml --color --no-ignore && spectral lint public/openapi.yml -F error"' | ||
run 'npm pkg set scripts.build:docs="swagger-cli bundle docs/openapi/openapi.yml --outfile public/openapi.yml --type yaml"' | ||
|
||
source_stylesheet = 'app/assets/stylesheets/application.scss' | ||
bundled_stylesheet = 'app/assets/builds/application.css' | ||
|
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