Skip to content

Commit

Permalink
Merge branch 'stoplightio:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ilanashapiro authored Apr 15, 2024
2 parents 8c648e8 + c114506 commit e23f815
Show file tree
Hide file tree
Showing 38 changed files with 3,104 additions and 2,709 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/jira-issue-label-added.yaml
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
19 changes: 19 additions & 0 deletions .github/workflows/pr-title.yml
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 }}
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
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
7 changes: 7 additions & 0 deletions .release-please-manifest.json
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"
}
263 changes: 169 additions & 94 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lerna.json
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"
}
5 changes: 5 additions & 0 deletions mlc_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"ignorePatterns": [
"^https://github\\.com/stoplightio/prism/compare/"
]
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
"test.harness": "jest -c ./jest.harness.config.js"
},
"resolutions": {
"sanitize-html": "2.3.3"
"sanitize-html": "2.12.1"
},
"devDependencies": {
"@stoplight/types": "^14.0.0",
"@stoplight/types": "^14.1.0",
"@types/caseless": "^0.12.2",
"@types/content-type": "^1.1.5",
"@types/jest": "^29.5.4",
"@types/json-schema": "^7.0.9",
"@types/lodash": "^4.14.175",
"@types/node": "^13.1.1",
"@types/node-fetch": "2.5.10",
"@types/pino": "6.3.8",
"@types/pino": "6.3.12",
"@types/postman-collection": "^3.5.7",
"@types/raw-body": "^2.3.0",
"@types/signale": "^1.4.2",
Expand All @@ -51,7 +51,7 @@
"eslint-plugin-prettier": "^4.2.1",
"fast-xml-parser": "^4.2.0",
"form-data": "^4.0.0",
"gavel": "^10.0.3",
"gavel": "10.0.3",
"glob": "^7.2.0",
"http-string-parser": "^0.0.6",
"husky": "^8.0.1",
Expand Down
44 changes: 44 additions & 0 deletions packages/cli/CHANGELOG.md
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
11 changes: 5 additions & 6 deletions packages/cli/package.json
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",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/__tests__/commands.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as operationUtils from '../../operations';
import * as operationUtils from '@stoplight/prism-http';
import * as yargs from 'yargs';
import { createMultiProcessPrism, createSingleProcessPrism } from '../../util/createServer';
import mockCommand from '../mock';
Expand Down
57 changes: 2 additions & 55 deletions packages/cli/src/operations.ts
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';
4 changes: 2 additions & 2 deletions packages/cli/src/util/createServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import * as signale from 'signale';
import * as split from 'split2';
import { PassThrough, Readable } from 'stream';
import { LOG_COLOR_MAP } from '../const/options';
import { CreatePrism } from './runner';
import { getHttpOperationsFromSpec } from '@stoplight/prism-http';
import { createExamplePath } from './paths';
import { attachTagsToParamsValues, transformPathParamsValues } from './colorizer';
import { CreatePrism } from './runner';
import { getHttpOperationsFromSpec } from '../operations';
import { configureExtensionsUserProvided } from '../extensions';

type PrismLogDescriptor = pino.LogDescriptor & {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/util/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { IPrismHttpServer } from '@stoplight/prism-http-server/src/types';
import * as chokidar from 'chokidar';
import * as os from 'os';
import { CreateMockServerOptions } from './createServer';
import { getHttpOperationsFromSpec } from '../operations';
import { getHttpOperationsFromSpec } from '@stoplight/prism-http';

export type CreatePrism = (options: CreateMockServerOptions) => Promise<IPrismHttpServer | void>;

Expand Down
8 changes: 8 additions & 0 deletions packages/core/CHANGELOG.md
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))
2 changes: 1 addition & 1 deletion packages/core/package.json
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]>",
Expand Down
38 changes: 38 additions & 0 deletions packages/http-server/CHANGELOG.md
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
8 changes: 4 additions & 4 deletions packages/http-server/package.json
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]>",
Expand All @@ -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",
Expand Down
Loading

0 comments on commit e23f815

Please sign in to comment.