forked from stoplightio/prism
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'stoplightio:master' into master
- Loading branch information
Showing
38 changed files
with
3,104 additions
and
2,709 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,13 @@ | ||
name: Jira Issue Label Added | ||
|
||
on: | ||
issues: | ||
types: | ||
- labeled | ||
|
||
jobs: | ||
call-workflow: | ||
uses: stoplightio/.github/.github/workflows/jira-issue-label-added.yaml@master | ||
with: | ||
team-name: ${{ contains(github.event.pull_request.labels.*.name, 'team/bear-claws') && 'Bear Claws' || contains(github.event.pull_request.labels.*.name, 'team/honey-hackers') && 'Honey Hackers' || contains(github.event.pull_request.labels.*.name, 'team/maintenance') && 'Maintenance' || '' }} | ||
secrets: inherit |
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,19 @@ | ||
name: 'PR title uses semantic release format' | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
|
||
permissions: | ||
pull-requests: read | ||
|
||
jobs: | ||
main: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/action-semantic-pull-request@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_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,30 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
# Create release PR | ||
release-please: | ||
name: Release Please | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'stoplightio/prism' | ||
outputs: | ||
release_created: ${{ steps.release.outputs.release_created }} | ||
tag_name: ${{ steps.release.outputs.tag_name }} | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: google-github-actions/release-please-action@v4 | ||
id: release | ||
with: | ||
token: ${{ secrets.RELEASE_PLEASE_GITHUB_TOKEN }} | ||
target-branch: master |
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 @@ | ||
{ | ||
".": "5.7.0", | ||
"packages/cli": "5.7.0", | ||
"packages/core": "5.6.0", | ||
"packages/http": "5.7.0", | ||
"packages/http-server": "5.7.0" | ||
} |
Large diffs are not rendered by default.
Oops, 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"packages": ["packages/*"], | ||
"npmClient": "yarn", | ||
"version": "5.5.1", | ||
"version": "5.5.4", | ||
"independent": false, | ||
"$schema": "node_modules/lerna/schemas/lerna-schema.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,5 @@ | ||
{ | ||
"ignorePatterns": [ | ||
"^https://github\\.com/stoplightio/prism/compare/" | ||
] | ||
} |
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,44 @@ | ||
# Changelog | ||
|
||
## [5.7.0](https://github.com/stoplightio/prism/compare/v5.6.0...v5.7.0) (2024-03-22) | ||
|
||
|
||
### Features | ||
|
||
* STOP-243 - create prism instance with full spec ([#2501](https://github.com/stoplightio/prism/issues/2501)) ([ed41dca](https://github.com/stoplightio/prism/commit/ed41dca89e5ad673f1a0d813b403a44de7e367b2)) | ||
|
||
|
||
### Dependencies | ||
|
||
* The following workspace dependencies were updated | ||
* dependencies | ||
* @stoplight/prism-http bumped from ^5.6.0 to ^5.7.0 | ||
* @stoplight/prism-http-server bumped from ^5.6.0 to ^5.7.0 | ||
|
||
## [5.6.0](https://github.com/stoplightio/prism/compare/v5.5.4...v5.6.0) (2024-03-18) | ||
|
||
|
||
### Features | ||
|
||
* 1813 start using 415 code for invalid content-types instead constantly inferring it ([df475fc](https://github.com/stoplightio/prism/commit/df475fcb67608428c143b3e6a988d95a1ef1fd3e)) | ||
* Allow JSON Schema Faker configuration in specification ([b72dd03](https://github.com/stoplightio/prism/commit/b72dd03e24bea4a7178c824eb0d83c68715f1503)) | ||
* **proxy:** add a flag to skip request validation ([71d04c8](https://github.com/stoplightio/prism/commit/71d04c8e19fef64f1354a17e51cf48a0d8b4bee7)) | ||
* support circular refs ([#1835](https://github.com/stoplightio/prism/issues/1835)) ([d287dd7](https://github.com/stoplightio/prism/commit/d287dd700c2597c0b20214c8340680dd42e20085)) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* fixed [#1860](https://github.com/stoplightio/prism/issues/1860) performance regression ([fe6345d](https://github.com/stoplightio/prism/commit/fe6345dc8a78dc0a0a30774c0175422c9cc93139)) | ||
* json schema faker fillProperties not working ([#2398](https://github.com/stoplightio/prism/issues/2398)) ([e8acebd](https://github.com/stoplightio/prism/commit/e8acebd430dfe3cfc9db7bda3228256153346488)) | ||
* update http-spec ([#2037](https://github.com/stoplightio/prism/issues/2037)) ([72d6882](https://github.com/stoplightio/prism/commit/72d6882bc39a673e65b1fc10ff88d3581b838dca)) | ||
* upgrade dependencies and resolve breaking http spec changes ([#2105](https://github.com/stoplightio/prism/issues/2105)) ([ebbc6c1](https://github.com/stoplightio/prism/commit/ebbc6c1546aced8db0f492dd80651d2459c9bae0)) | ||
* upgrade jsrp to 9.2.4 to allow basic auth ([#2279](https://github.com/stoplightio/prism/issues/2279)) ([2148a2b](https://github.com/stoplightio/prism/commit/2148a2bc9c43d2897900ffe5838d7bc76fd8a3d1)) | ||
|
||
|
||
### Dependencies | ||
|
||
* The following workspace dependencies were updated | ||
* dependencies | ||
* @stoplight/prism-core bumped from ^5.5.4 to ^5.6.0 | ||
* @stoplight/prism-http bumped from ^5.5.4 to ^5.6.0 | ||
* @stoplight/prism-http-server bumped from ^5.5.4 to ^5.6.0 |
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 |
---|---|---|
@@ -1,19 +1,18 @@ | ||
{ | ||
"name": "@stoplight/prism-cli", | ||
"version": "5.5.1", | ||
"version": "5.7.0", | ||
"author": "Stoplight <[email protected]>", | ||
"bin": { | ||
"prism": "./dist/index.js" | ||
}, | ||
"bugs": "https://github.com/stoplightio/prism/issues", | ||
"dependencies": { | ||
"@stoplight/http-spec": "^6.0.2", | ||
"@stoplight/json": "^3.18.1", | ||
"@stoplight/json-schema-ref-parser": "9.2.7", | ||
"@stoplight/prism-core": "^5.5.1", | ||
"@stoplight/prism-http": "^5.5.1", | ||
"@stoplight/prism-http-server": "^5.5.1", | ||
"@stoplight/types": "^14.0.0", | ||
"@stoplight/prism-core": "^5.6.0", | ||
"@stoplight/prism-http": "^5.7.0", | ||
"@stoplight/prism-http-server": "^5.7.0", | ||
"@stoplight/types": "^14.1.0", | ||
"chalk": "^4.1.2", | ||
"chokidar": "^3.5.2", | ||
"fp-ts": "^2.11.5", | ||
|
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 |
---|---|---|
@@ -1,55 +1,2 @@ | ||
import { transformOas3Operations } from '@stoplight/http-spec/oas3/operation'; | ||
import { transformOas2Operations } from '@stoplight/http-spec/oas2/operation'; | ||
import { transformPostmanCollectionOperations } from '@stoplight/http-spec/postman/operation'; | ||
import * as $RefParser from '@stoplight/json-schema-ref-parser'; | ||
import { HTTPResolverOptions } from '@stoplight/json-schema-ref-parser'; | ||
import { bundleTarget, decycle } from '@stoplight/json'; | ||
import { IHttpOperation } from '@stoplight/types'; | ||
import { get } from 'lodash'; | ||
import * as os from 'os'; | ||
import type { Spec } from 'swagger-schema-official'; | ||
import type { OpenAPIObject } from 'openapi3-ts'; | ||
import type { CollectionDefinition } from 'postman-collection'; | ||
|
||
export async function getHttpOperationsFromSpec(specFilePathOrObject: string | object): Promise<IHttpOperation[]> { | ||
const prismVersion = require('../package.json').version; | ||
const httpResolverOpts: HTTPResolverOptions = { | ||
headers: { | ||
'User-Agent': `PrismMockServer/${prismVersion} (${os.type()} ${os.arch()} ${os.release()})`, | ||
}, | ||
}; | ||
const result = decycle( | ||
await new $RefParser().dereference(specFilePathOrObject, { resolve: { http: httpResolverOpts } }) | ||
); | ||
|
||
let operations: IHttpOperation[] = []; | ||
if (isOpenAPI2(result)) operations = transformOas2Operations(result); | ||
else if (isOpenAPI3(result)) operations = transformOas3Operations(result); | ||
else if (isPostmanCollection(result)) operations = transformPostmanCollectionOperations(result); | ||
else throw new Error('Unsupported document format'); | ||
|
||
operations.forEach((op, i, ops) => { | ||
ops[i] = bundleTarget({ | ||
document: { | ||
...result, | ||
__target__: op, | ||
}, | ||
path: '#/__target__', | ||
cloneDocument: false, | ||
}); | ||
}); | ||
|
||
return operations; | ||
} | ||
|
||
function isOpenAPI2(document: unknown): document is Spec { | ||
return get(document, 'swagger') !== undefined; | ||
} | ||
|
||
function isOpenAPI3(document: unknown): document is OpenAPIObject { | ||
return get(document, 'openapi') !== undefined; | ||
} | ||
|
||
function isPostmanCollection(document: unknown): document is CollectionDefinition { | ||
return Array.isArray(get(document, 'item')) && get(document, 'info.name') !== undefined; | ||
} | ||
// add to keep this from being a breaking change. | ||
export { getHttpOperationsFromSpec } from '@stoplight/prism-http'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Changelog | ||
|
||
## [5.6.0](https://github.com/stoplightio/prism/compare/v5.5.4...v5.6.0) (2024-03-18) | ||
|
||
|
||
### Features | ||
|
||
* **http:** added support to Deprecation header for deprecated operations [#1563](https://github.com/stoplightio/prism/issues/1563) ([1415319](https://github.com/stoplightio/prism/commit/14153193c69bccd960e62bc2b86ec23470d66921)) |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@stoplight/prism-core", | ||
"version": "5.5.1", | ||
"version": "5.6.0", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"author": "Stoplight <[email protected]>", | ||
|
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,38 @@ | ||
# Changelog | ||
|
||
## [5.7.0](https://github.com/stoplightio/prism/compare/v5.6.0...v5.7.0) (2024-03-22) | ||
|
||
|
||
### Features | ||
|
||
* STOP-243 - create prism instance with full spec ([#2501](https://github.com/stoplightio/prism/issues/2501)) ([ed41dca](https://github.com/stoplightio/prism/commit/ed41dca89e5ad673f1a0d813b403a44de7e367b2)) | ||
|
||
|
||
### Dependencies | ||
|
||
* The following workspace dependencies were updated | ||
* dependencies | ||
* @stoplight/prism-http bumped from ^5.6.0 to ^5.7.0 | ||
|
||
## [5.6.0](https://github.com/stoplightio/prism/compare/v5.5.4...v5.6.0) (2024-03-18) | ||
|
||
|
||
### Features | ||
|
||
* 1813 start using 415 code for invalid content-types instead constantly inferring it ([df475fc](https://github.com/stoplightio/prism/commit/df475fcb67608428c143b3e6a988d95a1ef1fd3e)) | ||
* adds more standard compliant request body handling ([#2260](https://github.com/stoplightio/prism/issues/2260)) ([3b56cb7](https://github.com/stoplightio/prism/commit/3b56cb72f41d106cbcc95bb7c27711a3c05c6298)) | ||
* support circular refs ([#1835](https://github.com/stoplightio/prism/issues/1835)) ([d287dd7](https://github.com/stoplightio/prism/commit/d287dd700c2597c0b20214c8340680dd42e20085)) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* **http-server:** discard request body if the content-length header i… ([#2103](https://github.com/stoplightio/prism/issues/2103)) ([c172f42](https://github.com/stoplightio/prism/commit/c172f42c89d67c3963eb9962d0550d5126756d34)) | ||
* update http-spec ([#2037](https://github.com/stoplightio/prism/issues/2037)) ([72d6882](https://github.com/stoplightio/prism/commit/72d6882bc39a673e65b1fc10ff88d3581b838dca)) | ||
|
||
|
||
### Dependencies | ||
|
||
* The following workspace dependencies were updated | ||
* dependencies | ||
* @stoplight/prism-core bumped from ^5.5.4 to ^5.6.0 | ||
* @stoplight/prism-http bumped from ^5.5.4 to ^5.6.0 |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@stoplight/prism-http-server", | ||
"version": "5.5.1", | ||
"version": "5.7.0", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"author": "Stoplight <[email protected]>", | ||
|
@@ -19,9 +19,9 @@ | |
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@stoplight/prism-core": "^5.5.1", | ||
"@stoplight/prism-http": "^5.5.1", | ||
"@stoplight/types": "^14.0.0", | ||
"@stoplight/prism-core": "^5.6.0", | ||
"@stoplight/prism-http": "^5.7.0", | ||
"@stoplight/types": "^14.1.0", | ||
"fast-xml-parser": "^4.2.0", | ||
"fp-ts": "^2.11.5", | ||
"io-ts": "^2.2.16", | ||
|
Oops, something went wrong.