Skip to content

Commit

Permalink
Merge branch 'main' into update-sign-template
Browse files Browse the repository at this point in the history
  • Loading branch information
congminh1254 authored Sep 6, 2023
2 parents edda3a7 + d1763b5 commit 929d769
Show file tree
Hide file tree
Showing 9 changed files with 11,046 additions and 8,270 deletions.
52 changes: 42 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,38 @@ jobs:
run: |
yarn lint
# Verify compiled schema is up to date
# If this action fails, it means one have to run `yarn build:schema` and commit changes in the file
verify-compiled-schema-up-to-date:
name: Verify openapi.json file is up to date
# We run this on the latest ubuntu
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging' || github.event_name == 'pull_request'
timeout-minutes: 10

# We use node 14.X
strategy:
matrix:
node-version: [14.x]

# The following steps are performed for each job
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Compile the content
run: |
yarn install
yarn build:schema
- name: Verify openapi.json file is up to date (run 'yarn build:schema' and commit changes in openapi.json file if this command returns error)
run: git diff --quiet openapi.json

# The deploy task actually deploys any changes to the en branch
push-to-en:
# We run this on the latest ubuntu
Expand All @@ -73,7 +105,7 @@ jobs:
needs:
- lint

# The following steps are performed for each lint job
# The following steps are performed for each job
steps:
- name: Check out the repo
uses: actions/checkout@v3
Expand All @@ -86,23 +118,23 @@ jobs:
- name: Compile the content
run: |
yarn install
yarn build
yarn build:content
yarn build:swagger
- name: Push compiled content
uses: s0/[email protected]
env:
REPO: self
BRANCH: en
FOLDER: compiled/openapi
FOLDER: compiled/content
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Push GH pages for redundancy
uses: s0/[email protected]
env:
REPO: self
BRANCH: gh-pages
FOLDER: compiled/openapi
FOLDER: compiled/content
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Push Swagger 2.0 backport
Expand Down Expand Up @@ -168,7 +200,7 @@ jobs:
needs:
- lint

# The following steps are performed for each lint job
# The following steps are performed for each job
steps:
- name: Check out the repo
uses: actions/checkout@v3
Expand All @@ -181,14 +213,14 @@ jobs:
- name: Compile the content
run: |
yarn install
yarn build
yarn build:content
- name: Push compiled content
uses: s0/[email protected]
env:
REPO: self
BRANCH: en-staging
FOLDER: compiled/openapi
FOLDER: compiled/content
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Trigger Netlify deployment"
Expand Down Expand Up @@ -222,7 +254,7 @@ jobs:
# We run this on the latest ubuntu
runs-on: ubuntu-latest

# The following steps are performed for each lint job
# The following steps are performed for each job
steps:
- name: Check out the repo
uses: actions/checkout@v3
Expand All @@ -238,7 +270,7 @@ jobs:
run: |
cd $GITHUB_WORKSPACE/box-openapi
yarn install
yarn build
yarn build:content
- name: Check out the Codegen repo
uses: actions/checkout@v3
Expand All @@ -254,5 +286,5 @@ jobs:
npm install
cd scripts
npm install
cp $GITHUB_WORKSPACE/box-openapi/compiled/openapi/openapi.json .
cp $GITHUB_WORKSPACE/box-openapi/compiled/content/openapi.json .
npm run validate ./openapi.json
5 changes: 2 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ yarn install
yarn start
```

This final `yarn start` command starts up a local server and watches the files
for changes. It will open up a browser window with a preview of the compiled API
specification.
This final `yarn start` command starts up a local server. It will open up
a browser window with a preview of the API specification.

## Lint and validate the tests

Expand Down
33 changes: 6 additions & 27 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -6657,7 +6657,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Metadata"
"$ref": "#/components/schemas/Metadata--Full"
}
}
}
Expand Down Expand Up @@ -25781,10 +25781,10 @@
},
"type": {
"type": "string",
"description": "`collaboration_whitelist`",
"example": "collaboration_whitelist",
"description": "`collaboration_whitelist_exempt_target`",
"example": "collaboration_whitelist_exempt_target",
"enum": [
"collaboration_whitelist"
"collaboration_whitelist_exempt_target"
]
},
"enterprise": {
Expand Down Expand Up @@ -25822,29 +25822,7 @@
"user": {
"allOf": [
{
"title": "Enterprise",
"type": "object",
"description": "A representation of a Box enterprise",
"properties": {
"id": {
"type": "string",
"description": "The unique identifier for this enterprise.",
"example": "11446498"
},
"type": {
"type": "string",
"description": "`enterprise`",
"example": "enterprise",
"enum": [
"enterprise"
]
},
"name": {
"description": "The name of the enterprise",
"example": "Acme Inc.",
"type": "string"
}
}
"$ref": "#/components/schemas/User--Mini"
},
{
"description": "The user that has been exempt"
Expand Down Expand Up @@ -35140,6 +35118,7 @@
"x-box-variant": "base",
"description": "A mini representation of a user, used when\nnested within another resource.",
"required": [
"id",
"type"
],
"properties": {
Expand Down
39 changes: 17 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,23 @@
"version": "3.0.2",
"description": "Box Platform OpenAPI Specification",
"scripts": {
"prelint": "concurrently 'yarn lint:yaml' 'yarn build:dev'",
"lint": "concurrently 'yarn:lint:spectral' 'yarn:lint:spelling' 'yarn lint:markdown:spelling' 'yarn:lint:sensitivity' 'yarn lint:markdown'",
"lint:spectral": "NODE_NO_WARNINGS=1 spectral lint ./src/dev/openapi.json -F error",
"lint:spelling": "json-schema-spell-checker -a -n -d src/dictionaries/en_US -f 'description,title,summary' ./src/dev/openapi.json",
"prelint": "concurrently 'yarn lint:yaml' 'yarn build:schema'",
"lint": "concurrently 'yarn lint:spectral' 'yarn lint:spelling' 'yarn lint:markdown:spelling' 'yarn lint:sensitivity' 'yarn lint:markdown'",
"lint:spectral": "NODE_NO_WARNINGS=1 spectral lint openapi.json -F error",
"lint:spelling": "json-schema-spell-checker -a -n -d src/dictionaries/en_US -f 'description,title,summary' openapi.json",
"lint:markdown:spelling": "mdspell '*.md' './.github/**/*.md' 'docs/*.md' -a -n --en-us -d src/dictionaries/en_US -r",
"lint:sensitivity": "json-schema-sensitivity-checker -f 'description,title,summary' ./src/dev/openapi.json -c .alexrc.json",
"lint:sensitivity": "json-schema-sensitivity-checker -f 'description,title,summary' openapi.json -c .alexrc.json",
"lint:yaml": "yamllint content/",
"lint:markdown": "markdownlint -c markdownlintrc.json ./*.md ./docs/*.md ./.github/**/*.md",
"watch": "concurrently 'yarn:watch:*'",
"watch:tests": "watch 'yarn test' content src/scripts src/spectral docs",
"watch:build": "watch 'yarn run build:dev' content",
"clean": "rm -rf compiled && mkdir compiled",
"prebuild": "yarn run clean & yarn run build:index",
"build": "NODE_NO_WARNINGS=1 node -e 'require(\"./src/scripts/specLoader\").writeSpecification(\"./compiled/openapi\")'",
"build:dev": "NODE_NO_WARNINGS=1 node -e 'require(\"./src/scripts/specLoader\").writeSpecification(\"src/dev\")'",
"test": "yarn lint",
"prebuild": "yarn run build:index",
"build": "cp -rf openapi.json src/dev/openapi.json",
"build:index": "webpack --config webpack.dev.js",
"build:copy": "cp -rf .github src/dev/index.build.js src/dev/index.html src/dev/auth.html compiled/openapi",
"build:swagger": "node -e 'require(\"./src/scripts/swaggerConverter\").writeSpecification(\"./compiled/swagger\")'",
"postbuild": "yarn run build:copy",
"dev-server": "webpack serve --config webpack.dev.js",
"start": "concurrently 'yarn:dev-server' 'yarn:watch'",
"test": "yarn lint"
"build:content": "rm -rf compiled/content && mkdir -p compiled/content && yarn build:index && cp -rf .github openapi.json src/dev/index.build.js src/dev/index.html src/dev/auth.html compiled/content",
"build:swagger": "rm -rf compiled/swagger && mkdir -p compiled/swagger && node -e 'require(\"./src/scripts/swaggerConverter\").writeSpecification(\"./compiled/swagger\")'",
"build:schema": "NODE_NO_WARNINGS=1 node -e 'require(\"./src/scripts/specLoader\").writeSpecification(\".\")'",
"prestart": "yarn build",
"start": "webpack serve --config webpack.dev.js"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -58,11 +53,11 @@
"markdown-spellcheck": "^1.3.1",
"markdownlint-cli": "^0.25.0",
"style-loader": "^2.0.0",
"swagger-ui": "^4.18.1",
"swagger-ui": "^4.19.1",
"watch": "^1.0.2",
"webpack": "^5.7.0",
"webpack-cli": "^4.2.0",
"webpack-dev-server": "^4.11.1"
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1"
},
"private": true
}
}
Loading

0 comments on commit 929d769

Please sign in to comment.