profile
viewpoint

lukasz-kuzynski-11sigma/cascade 0

Run cascade actions like deletions, updates from your code instead of database

lukasz-kuzynski-11sigma/json-schema-faker 0

JSON-Schema + fake data generators

stoplightio/httpbin 0

HTTP Request & Response Service, written in Python + Flask.

issue closedstoplightio/prism

Move optimizely logic to @libs/experiments

Move logic from groups/projects service to @lib/experiments

closed time in 8 hours

lukasz-kuzynski-11sigma

issue openedstoplightio/prism

Move optimizely logic to @libs/experiments

Move logic from groups/projects service to @lib/experiments

created time in 8 hours

pull request commentstoplightio/prism

Update 01-installation.md

Thank You! :)

sergioviniciuss

comment created time in 4 days

push eventstoplightio/prism

Sérgio Vinícius

commit sha a923299102b0b801a298a671f5ac4f937b0a5513

Update 01-installation.md Fix a typo in the documentation

view details

lukasz-kuzynski-11sigma

commit sha 8888233a91415284de9151f5cb4e79dc98248628

Merge pull request #1955 from sergioviniciuss/patch-1 Update 01-installation.md

view details

push time in 4 days

PullRequestReviewEvent

issue closedstoplightio/prism

Investigate why useAllResults might endup in infinite loop

As a followup to:

  • https://github.com/stoplightio/platform-internal/issues/8870

closed time in 13 days

lukasz-kuzynski-11sigma

issue openedstoplightio/prism

Investigate why useAllResults might endup in infinite loop

As a followup to:

  • https://github.com/stoplightio/platform-internal/issues/8870

created time in 13 days

issue closedstoplightio/prism

Support 415 responses for unsupported media types in requests

Describe the bug

It appears that content type validation is not working as I can POST a body with an unacceptable content type (vs what the API definition states is allowed) and it is accepted without error

To Reproduce

Run prism and with an operation that accepts a post body, send a body but with a "content-type" header that is not in the openAPI definition

Expected behavior

A http 415 is returned informing the user which content types are accepted

Notes

This works great for accept headers when as a consumer I ask for something in a format that is not supported. This bug is to protect against consumers sending bad content types in their request bodies.

Screenshots image

closed time in 22 days

savage-alex

PR merged stoplightio/prism

4.6.0

Version 4.6.0

+17 -11

0 comment

6 changed files

lukasz-kuzynski-11sigma

pr closed time in 22 days

push eventstoplightio/prism

Łukasz Kużyński

commit sha 7ba731324bb6eb07b93e2e15a22363e992808c7e

Version 4.6.0

view details

Łukasz Kużyński

commit sha b27850d74fa0fa8f70fecd53b3e65f319d7b15bd

v4.6.0

view details

lukasz-kuzynski-11sigma

commit sha 9a0396d22c07d39f3bc50a6b43aae9ab18392154

Merge pull request #1938 from stoplightio/4.6.0 4.6.0

view details

push time in 22 days

delete branch stoplightio/prism

delete branch : 4.6.0

delete time in 22 days

PR opened stoplightio/prism

Reviewers
4.6.0

Version 4.6.0

+17 -11

0 comment

6 changed files

pr created time in 22 days

created tagstoplightio/prism

tagv4.6.0

Turn any OpenAPI2/3 and Postman Collection file into an API server with mocking, transformations and validations.

created time in 22 days

push eventstoplightio/prism

Łukasz Kużyński

commit sha b27850d74fa0fa8f70fecd53b3e65f319d7b15bd

v4.6.0

view details

push time in 22 days

create barnchstoplightio/prism

branch : 4.6.0

created branch time in 22 days

push eventstoplightio/prism

Łukasz Kużyński

commit sha df475fcb67608428c143b3e6a988d95a1ef1fd3e

feat: 1813 start using 415 code for invalid content-types instead constantly inferring it

view details

Łukasz Kużyński

commit sha d14e30ac9ebde4f49f16766cb0235bd8a70bfd61

chore: fixed tests

view details

Łukasz Kużyński

commit sha 44505fe370077d9a1151c2b2231c6a230899754a

chore: tests fix

view details

Łukasz Kużyński

commit sha a0c1fc096f3e2b7102b2b4656657945b0951810e

chore: fixed after PR

view details

Łukasz Kużyński

commit sha f5c13f6e6602809a8acfd5390feb8538e65f65ac

chore: new decision tree image

view details

Łukasz Kużyński

commit sha 2abc149613c85255bc07ac7e55be5b69d25f3d29

chore: fixed image decision tree

view details

Łukasz Kużyński

commit sha 7db88688e9006ec8856dd8d5e131b9d5653d2d0a

chore: fixed dead link to decision diagram image

view details

lukasz-kuzynski-11sigma

commit sha 92ef6e41b08c95ea81570ebf741dce117bd205ac

Merge pull request #1935 from stoplightio/fix/1813-support-for-415-response-code feat: 1813 start using 415 code for invalid content-types instead constantly inferring it

view details

push time in 22 days

delete branch stoplightio/prism

delete branch : fix/1813-support-for-415-response-code

delete time in 22 days

PR merged stoplightio/prism

feat: 1813 start using 415 code for invalid content-types instead constantly inferring it

Addresses #1813

Summary

Replace this with something that explains what this PR is for and why it matters.

Checklist

  • The basics
    • [x] I tested these changes manually in my local or dev environment
  • Tests
    • [ ] Added or updated
    • [x] N/A
  • Event Tracking
    • [ ] I added event tracking and followed the event tracking guidelines
    • [x] N/A
  • Error Reporting
    • [ ] I reported errors and followed the error reporting guidelines
    • [x] N/A
+340 -77

1 comment

19 changed files

lukasz-kuzynski-11sigma

pr closed time in 22 days

push eventstoplightio/prism

Łukasz Kużyński

commit sha 7db88688e9006ec8856dd8d5e131b9d5653d2d0a

chore: fixed dead link to decision diagram image

view details

push time in 22 days

push eventstoplightio/prism

Łukasz Kużyński

commit sha 2abc149613c85255bc07ac7e55be5b69d25f3d29

chore: fixed image decision tree

view details

push time in 23 days

push eventstoplightio/prism

Łukasz Kużyński

commit sha f5c13f6e6602809a8acfd5390feb8538e65f65ac

chore: new decision tree image

view details

push time in 23 days

PullRequestReviewEvent

Pull request review commentstoplightio/prism

feat: 1813 start using 415 code for invalid content-types instead constantly inferring it

 describe('Checks if memory leaks', () => {     }      global.gc();-    expect(process.memoryUsage().heapUsed).toBeLessThanOrEqual(baseMemoryUsage * 1.02);+    expect(process.memoryUsage().heapUsed).toBeLessThanOrEqual(baseMemoryUsage * 1.03);

Yep :( I had to raise it to prevent flakiness

lukasz-kuzynski-11sigma

comment created time in 25 days

Pull request review commentstoplightio/prism

feat: 1813 start using 415 code for invalid content-types instead constantly inferring it

+import { parse, ParsedMediaType } from 'content-type';+import * as O from 'fp-ts/Option';+import { pipe } from 'fp-ts/function';++export function wildcardMediaTypeMatch(mediaTypeA: string, mediaTypeB: string) {+  return pipe(+    O.Do,+    O.bind('a', () => parseContentType(mediaTypeA)),+    O.bind('b', () => parseContentType(mediaTypeB)),+    O.fold(+      () => false,+      ({ a, b }) => {+        return a.type === b.type && a.subtype === b.subtype;+      }+    )+  );+}++const REGEXP = /^([-\w.]+)\/(?:([-\w.]+)\+)?([-\w.]+)$/;++function parseContentType(contentType: string): O.Option<ParsedContentType> {+  return pipe(+    O.tryCatch<ParsedMediaType>(() => parse(contentType)),+    O.chain(({ type }) => {+      const match = REGEXP.exec(type.toLowerCase());++      if (!match) {+        return O.none;+      }++      const hasExtension = match.length === 4;+      return O.some({+        type: match[1],+        subtype: match[hasExtension ? 3 : 2],+        extension: hasExtension ? match[2] : undefined,+      });+    })+  );+}++interface ParsedContentType {+  type: string;+  subtype: string;+  extension?: string;

Done

lukasz-kuzynski-11sigma

comment created time in 25 days

Pull request review commentstoplightio/prism

feat: 1813 start using 415 code for invalid content-types instead constantly inferring it

 export async function configureExtensionsFromSpec(specFilePathOrObject: string |   const result = decycle(await dereference(specFilePathOrObject));    forOwn(get(result, 'x-json-schema-faker', {}), (value: any, option: string) => {-    if (option === 'locale') return jsf.locate('faker').setLocale(value);+    if (option === 'locale') {+      // @ts-ignore

Done

lukasz-kuzynski-11sigma

comment created time in 25 days

Pull request review commentstoplightio/prism

feat: 1813 start using 415 code for invalid content-types instead constantly inferring it

+import { parse, ParsedMediaType } from 'content-type';+import * as O from 'fp-ts/Option';+import { pipe } from 'fp-ts/function';++export function wildcardMediaTypeMatch(mediaTypeA: string, mediaTypeB: string) {+  return pipe(+    O.Do,+    O.bind('a', () => parseContentType(mediaTypeA)),+    O.bind('b', () => parseContentType(mediaTypeB)),+    O.fold(+      () => false,+      ({ a, b }) => {+        return a.type === b.type && a.subtype === b.subtype;+      }+    )+  );+}++const REGEXP = /^([-\w.]+)\/(?:([-\w.]+)\+)?([-\w.]+)$/;

Fixed

lukasz-kuzynski-11sigma

comment created time in 25 days

Pull request review commentstoplightio/prism

feat: 1813 start using 415 code for invalid content-types instead constantly inferring it

 const checkBodyIsProvided = (requestBody: IHttpOperationRequestBody, body: unkno     )   ); +const isMediaTypeDefinedInContents = (mediaType?: string, contents?: IMediaTypeContent[]): boolean =>

Done

lukasz-kuzynski-11sigma

comment created time in 25 days

Pull request review commentstoplightio/prism

feat: 1813 start using 415 code for invalid content-types instead constantly inferring it

 export function createInvalidInputResponse( ): R.Reader<Logger, E.Either<ProblemJsonError, IHttpNegotiationResult>> {   const securityValidation = failedValidations.find(validation => validation.code === 401);

Done

lukasz-kuzynski-11sigma

comment created time in 25 days

Pull request review commentstoplightio/prism

feat: 1813 start using 415 code for invalid content-types instead constantly inferring it

 import { pipe } from 'fp-ts/function'; import * as E from 'fp-ts/lib/Either'; import { stripWriteOnlyProperties } from '../../utils/filterRequiredProperties'; +// @ts-ignore

Done

lukasz-kuzynski-11sigma

comment created time in 25 days

Pull request review commentstoplightio/prism

feat: 1813 start using 415 code for invalid content-types instead constantly inferring it

 export function createInvalidInputResponse(           if (error instanceof ProblemJsonError && error.status === 404) {             return error;           }-          return securityValidation-            ? createUnauthorisedResponse(securityValidation.tags)-            : createUnprocessableEntityResponse(failedValidations);+          return createResponseForViolations(failedValidations);         })       )     )   ); } +function getExpectedCodesForViolations(failedValidations: NonEmptyArray<IPrismDiagnostic>): NonEmptyArray<number> {

Fixed

lukasz-kuzynski-11sigma

comment created time in 25 days

more