-
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.
Merge pull request #474 from nimblehq/release/5.9.0
Release 5.9.0
- Loading branch information
Showing
40 changed files
with
525 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# See https://git-scm.com/docs/gitattributes for more about git attribute files. | ||
|
||
# Mark any vendored files as having been vendored. | ||
vendor/* linguist-vendored |
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
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
22 changes: 22 additions & 0 deletions
22
.template/addons/openapi/.github/workflows/deploy_mock_server.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,22 @@ | ||
name: Deploy Mock Server | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy mock server | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up flyctl | ||
uses: superfly/flyctl-actions/setup-flyctl@master | ||
|
||
- name: Deploy to fly | ||
run: flyctl deploy --remote-only | ||
env: | ||
FLY_API_TOKEN: {{ "${{ secrets.FLY_API_TOKEN }}" }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
append_to_file '.gitignore' do | ||
<<~IGNORE | ||
# Ignore generated OpenAPI file | ||
/public/openapi.yml | ||
IGNORE | ||
end |
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 |
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,7 @@ | ||
FROM stoplight/prism:latest | ||
|
||
COPY /docs /usr/src/prism/packages/cli/docs/ | ||
|
||
EXPOSE 80 | ||
|
||
CMD ["mock", "-h", "0.0.0.0", "-p", "80", "docs/openapi/openapi.yml"] |
Empty file.
24 changes: 24 additions & 0 deletions
24
.template/addons/openapi/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" |
11 changes: 11 additions & 0 deletions
11
.template/addons/openapi/docs/openapi/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/openapi/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 |
15 changes: 15 additions & 0 deletions
15
.template/addons/openapi/docs/openapi/schemas/shared/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,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." |
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,13 @@ | ||
app = "api-mock-server" | ||
primary_region = "sin" | ||
|
||
[build] | ||
dockerfile = "Dockerfile.mock" | ||
|
||
[http_service] | ||
internal_port = 80 | ||
force_https = true | ||
auto_stop_machines = true | ||
auto_start_machines = true | ||
min_machines_running = 0 | ||
processes = ["app"] |
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,27 @@ | ||
# frozen_string_literal: true | ||
|
||
# Create package.json file | ||
unless File.exist?('package.json') | ||
create_file 'package.json', | ||
<<~JSON | ||
{ | ||
"name": "#{APP_NAME}", | ||
"private": "true" | ||
} | ||
JSON | ||
end | ||
|
||
run 'yarn add --dev eslint' | ||
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.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="yarn lint:docs:yml && yarn lint:docs:openapi"' | ||
run 'npm pkg set scripts.lint:docs:public="yarn 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"' |
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 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<title>API documentation</title> | ||
<!-- Embed Elements via Web Component --> | ||
<script src="https://unpkg.com/@stoplight/elements/web-components.min.js"></script> | ||
<link rel="stylesheet" href="https://unpkg.com/@stoplight/elements/styles.min.css"> | ||
</head> | ||
|
||
<body> | ||
<elements-api apiDescriptionUrl="/openapi.yml" router="hash" layout="sidebar" /> | ||
</body> | ||
</html> |
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 @@ | ||
# frozen_string_literal: true | ||
|
||
use_source_path __dir__ | ||
|
||
directory 'docs' | ||
directory '.github' if @install_github_action | ||
apply '.gitignore.rb' | ||
apply 'package.json.rb' | ||
copy_file '.spectral.yml' | ||
copy_file 'public/openapi.html' | ||
|
||
if yes?(install_addon_prompt('Mock Server')) | ||
@install_mock_server = true | ||
copy_file 'fly.toml' | ||
copy_file 'Dockerfile.mock' | ||
end | ||
|
||
after_bundle do | ||
run 'yarn build:docs' | ||
end |
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.