Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide support for OpenAPI 3.1.0 #2738

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
94f47a9
chore: integrate ApiDOM into codebase
char0n Dec 27, 2022
a4e6e52
feat(resolve): add ApiDOM JSON parser (#2739)
char0n Dec 27, 2022
c3de393
chore(deps): fix missing dependencies
char0n Dec 27, 2022
db4737f
feat(resolve): add ApiDOM YAML 1.2 parser
char0n Dec 27, 2022
dc5b833
feat(resolve): add ApiDOM OpenAPI 3.1.0 JSON parser
char0n Dec 27, 2022
77504ec
feat(resolve): add ApiDOM OpenAPI 3.1.0 YAML 1.2 parser
char0n Dec 27, 2022
c75e386
refactor(apidom): remove redundant composition arguments
char0n Dec 28, 2022
a3be4e4
chore(eslint): set ecmaVersion to 2020 in .eslintrc
char0n Dec 28, 2022
1ba8568
test(resolve): add tests for ApiDOM JSON parser
char0n Dec 28, 2022
a0fd00b
test(resolve): add tests for ApiDOM YAML 1.2 parser
char0n Dec 28, 2022
3a33ab0
test(resolve): add tests for ApiDOM OpenAPI 3.1.0 JSON parser
char0n Dec 28, 2022
30031f7
test(resolve): add tests for ApiDOM OpenAPI 3.1.0 YAML 1.2 parser
char0n Dec 28, 2022
da9c12f
test(helpers): re-organize tests to reflect code structure
char0n Dec 28, 2022
485bb01
feat(resolve): add ApiDOM resolver based on SwaggerClient HTTP client
char0n Dec 29, 2022
945bf92
feat: add OpenAPI 3.1.0 dereference strategy (#2740)
char0n Dec 31, 2022
b146526
refactor(helpers): reorganize OpenAPI predicates into separate module
char0n Jan 2, 2023
c0ee0a6
refactor(helpers): reorganize helpers in backward compatible way
char0n Jan 3, 2023
8c38540
test(helpers): re-organize tests to reflect code structure
char0n Jan 3, 2023
58981e4
feat(normalization): introduce normalization for OpenAPI 3.1.0
char0n Jan 3, 2023
085fc57
refactor(resolver): refactor code to allow using strategy pattern
char0n Jan 3, 2023
e04ead9
feat(resolver): add support for OpenAPI 3.1.0 resolution
char0n Jan 4, 2023
0cb9b6b
build: set minimum runtime Node.js version to 12.20.0
char0n Jan 5, 2023
d3a73fd
fix(resolver): fix useCircularStructure option support in OpenAPI 3.1
char0n Jan 5, 2023
2402a19
test(resolver): add tests for OpenAPI 3.1.0 allowMetaPatches option
char0n Jan 6, 2023
bb2953d
test(resolver): add tests for OpenAPI 3.1 useCircularStructures opt
char0n Jan 10, 2023
835a240
test(resolver): add tests for OpenAPI 3.1 spec obj resolution
char0n Jan 10, 2023
1a4f565
test(resolver): add tests for OpenAPI 3.1 skipNormalization option
char0n Jan 10, 2023
181f5e6
refactor(resolver): use constant HTTPS baseURI in non-browser env
char0n Jan 11, 2023
e71c989
feat(resolver): add support for pathDiscriminator option
char0n Jan 16, 2023
34f8a4b
feat(resolver): add support for parameterMacro option
char0n Jan 16, 2023
09c589a
feat(resolver): limit depth of dereference to max 100
char0n Jan 16, 2023
4f3ceda
feat(resolver): add support for modelPropertyMacro option
char0n Jan 17, 2023
75083b6
feat(subtree-resolver): adapt to support OpenAPI 3.1.0
char0n Jan 17, 2023
e8a6340
test: use original coverage thresholds
char0n Jan 18, 2023
9933d25
refactor(resolver): apply SRP for OpenAPI 3.1 deref strategy
char0n Jan 18, 2023
5e9cf3d
feat(resolver): add support for mode resolver option
char0n Jan 19, 2023
ab719a0
chore(deps): bundle ApiDOM dependencies
char0n Jan 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 17 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
},
"globals": {
"File": true,
"Blob": true
"Blob": true,
"globalThis": true
},
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2020,
"ecmaFeatures": {
"impliedStrict": true
}
Expand All @@ -32,6 +34,20 @@
"ignorePackages": true
}
],
"import/no-unresolved": [
2,
{
"ignore": [
"^@swagger-api/apidom-reference/configuration/empty$",
"^@swagger-api/apidom-reference/dereference/strategies/openapi-3-1$",
"^@swagger-api/apidom-reference/dereference/strategies/openapi-3-1/selectors/\\$anchor$",
"^@swagger-api/apidom-reference/dereference/strategies/openapi-3-1/selectors/uri$",
"^@swagger-api/apidom-reference/resolve/resolvers/file$",
"^@swagger-api/apidom-reference/resolve/strategies/openapi-3-1$",
"^@swagger-api/apidom-reference/parse/parsers/binary$"
]
}
],
"prettier/prettier": "error",
"no-param-reassign": 0, // needs to be eliminated in future
"no-use-before-define": [2, "nofunc"] // needs to be eliminated in future
Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
registry-url: https://npm.pkg.github.com/
scope: "@swagger-api"
- name: Cache Node Modules
id: cache-node-modules
uses: actions/cache@v2
Expand All @@ -32,6 +34,8 @@ jobs:
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Lint commit message
if: github.ref != 'refs/heads/main' && github.actor != 'dependabot[bot]'
run: git log -1 --pretty=format:"%s" | npx commitlint
Expand All @@ -57,10 +61,12 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.4.x
- name: Use Node.js 12.20.0
uses: actions/setup-node@v2
with:
node-version: 12.4.x
node-version: 12.20.0
registry-url: https://npm.pkg.github.com/
scope: "@swagger-api"
- name: Cache Node Modules
id: cache-node-modules
uses: actions/cache@v2
Expand All @@ -70,25 +76,31 @@ jobs:
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Download commonjs build artifacts
uses: actions/download-artifact@v1
with:
name: commonjs

- name: Run commonjs build artifacts on Node.js 12.4.x
- name: Run commonjs build artifacts on Node.js 12.20.0
run: node -p "require('./commonjs')"

- name: Use Node 14.x
uses: actions/setup-node@v2
with:
node-version: 14.x
registry-url: https://npm.pkg.github.com/
scope: "@swagger-api"
- name: Run commonjs build artifacts on Node.js 14.x
run: node -p "require('./commonjs')"

- name: Use Node 16.x
uses: actions/setup-node@v2
with:
node-version: 16.x
registry-url: https://npm.pkg.github.com/
scope: "@swagger-api"
- name: Run commonjs build artifacts on Node.js 16.x
run: node -p "require('./commonjs')"
17 changes: 6 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
name: Release
on:
workflow_run:
workflows:
- "Node.js CI"
workflow_dispatch:
branches:
- master
types:
- completed
- cha0rn/openapi-3-1-support
jobs:
release:
name: Release
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16

registry-url: https://npm.pkg.github.com/
scope: "@swagger-api"
- name: Install dependencies
run: npm ci

env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Semantic Release
id: semantic
uses: cycjimmy/[email protected]
Expand All @@ -37,7 +33,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Release published
if: steps.semantic.outputs.new_release_published == 'true'
run: |
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@swagger-api:registry=https://npm.pkg.github.com
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.17
16.16
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Swagger Client Version | Release Date | OpenAPI Spec compatibility | Notes

### Runtime

- Node.js `>=` 12.4.x
- Node.js `>=`12.20.0
- `swagger-client` works in the latest versions of Chrome, Safari, Firefox, and Edge.

## Security contact
Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
corejs: { version: 3 },
useBuiltIns: false,
targets: {
node: '12.4',
node: '12.20.0',
},
forceAllTransforms: false,
ignoreBrowserslistConfig: true,
Expand Down
16 changes: 16 additions & 0 deletions config/jest/jest.artifact-commonjs.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,20 @@ module.exports = {
rootDir: path.join(__dirname, '..', '..'),
testEnvironment: 'node',
testMatch: ['**/test/build-artifacts/commonjs.js'],
moduleNameMapper: {
/**
* This is here only until next version of Jest is released - 29.4.x.
* Jest doesn't support package.json imports fields now, so we have
* to provide this workaround.
*
* More information in https://github.com/facebook/jest/issues/12270.
*
*/
'#buffer':
'<rootDir>/node_modules/@swagger-api/apidom-reference/cjs/util/polyfills/buffer/protocol-import.cjs',
'#fs':
'<rootDir>/node_modules/@swagger-api/apidom-reference/cjs/util/polyfills/fs/protocol-import.cjs',
'#util':
'<rootDir>/node_modules/@swagger-api/apidom-reference/cjs/util/polyfills/util/protocol-import.cjs',
},
};
16 changes: 16 additions & 0 deletions config/jest/jest.artifact-es.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,20 @@ module.exports = {
rootDir: path.join(__dirname, '..', '..'),
testEnvironment: 'node',
testMatch: ['**/test/build-artifacts/es.js'],
moduleNameMapper: {
/**
* This is here only until next version of Jest is released - 29.4.x.
* Jest doesn't support package.json imports fields now, so we have
* to provide this workaround.
*
* More information in https://github.com/facebook/jest/issues/12270.
*
*/
'#buffer':
'<rootDir>/node_modules/@swagger-api/apidom-reference/cjs/util/polyfills/buffer/protocol-import.cjs',
'#fs':
'<rootDir>/node_modules/@swagger-api/apidom-reference/cjs/util/polyfills/fs/protocol-import.cjs',
'#util':
'<rootDir>/node_modules/@swagger-api/apidom-reference/cjs/util/polyfills/util/protocol-import.cjs',
},
};
16 changes: 16 additions & 0 deletions config/jest/jest.unit.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,28 @@ module.exports = {
moduleNameMapper: {
'formdata-node/lib/cjs/fileFromPath.js':
'<rootDir>/node_modules/formdata-node/lib/cjs/fileFromPath.js',
/**
* This is here only until next version of Jest is released - 29.4.x.
* Jest doesn't support package.json imports fields now, so we have
* to provide this workaround.
*
* More information in https://github.com/facebook/jest/issues/12270.
*
*/
'#buffer':
'<rootDir>/node_modules/@swagger-api/apidom-reference/cjs/util/polyfills/buffer/protocol-import.cjs',
'#fs':
'<rootDir>/node_modules/@swagger-api/apidom-reference/cjs/util/polyfills/fs/protocol-import.cjs',
'#util':
'<rootDir>/node_modules/@swagger-api/apidom-reference/cjs/util/polyfills/util/protocol-import.cjs',
},
testPathIgnorePatterns: [
'<rootDir>/node_modules/',
'<rootDir>/test/data/',
'<rootDir>/test/jest.setup.js',
'<rootDir>/test/specmap/data/',
'<rootDir>/test/build-artifacts/',
'/__fixtures__/',
'/__utils__/',
],
};
6 changes: 3 additions & 3 deletions config/jest/jest.unit.coverage.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
const unitConfig = require('./jest.unit.config');
const unitConfig = require('./jest.unit.config.js');

module.exports = {
...unitConfig,
collectCoverage: true,
collectCoverageFrom: ['src/**/*.js'],
coverageThreshold: {
'./src/': {
branches: 87,
branches: 86,
functions: 91,
lines: 90,
statements: 90,
statements: 89,
},
},
};
2 changes: 1 addition & 1 deletion config/webpack/browser.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const browserMin = {
devtool: 'source-map',
performance: {
hints: 'error',
maxEntrypointSize: 270000,
maxEntrypointSize: 500000,
maxAssetSize: 1300000,
},
output: {
Expand Down
15 changes: 2 additions & 13 deletions docs/development/setting-up.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,11 @@
### Prerequisites

- git, any version
- NPM >=6.12.x
- Node.js >=16.16
- NPM >=8.11.0

Generally, we recommend following guidelines from [Node.js Releases](https://nodejs.org/en/about/releases/) to only use `Current`, `Active LTS` or `Maintenance LTS` releases.

Current Node.js:
- Node.js 16.x
- NPM >=7.10.x

Current Node.js Active LTS:
- Node.js >=14.x
- NPM >=6.14.x

Current Node.js Maintenance LTS:
- Node.js >12.4
- NPM >=6.12.x

### Steps

1. `git clone https://github.com/swagger-api/swagger-js.git`
Expand Down
Loading