Prop not found
Request terminated with error: Error: Error: Prop not found: __bundled__
Context
We use Prism for our development mock server, @stoplight/prism-cli version@^5.0.1.
When upgrading to Angular 18, I deleted our package-lock and a new version of @stoplight/json was installed (v3.21.6), as peer dependency of the cli, which broke some endpoints.
I checked the package-lock that I threw out and I can see @stoplight/[email protected] was installed before , so the issue seems related to a patch version in the 3.21.x series.
Behavior
The error occurs when there are multiple endpoints that respond with the same schema (in this example FooBar):
/foo/a:
get:
operationId: getStatuses
tags:
- Foo
parameters:
- $ref: '#/components/parameters/q_language'
responses:
200:
$ref: '#/components/responses/OkA'
204:
$ref: '#/components/responses/NoContent'
400:
$ref: '#/components/responses/BadRequest'
500:
$ref:
'#/components/responses/InternalServerError'
/foo/b:
get:
operationId: getRegions
tags:
- Foo
parameters:
- $ref: '#/components/parameters/q_language'
responses:
200:
$ref: '#/components/responses/OkB'
204:
$ref: '#/components/responses/NoContent'
400:
$ref: '#/components/responses/BadRequest'
500:
$ref:
'#/components/responses/InternalServerError'
OkA:
content:
application/json:
schema:
$ref: '#/components/schemas/FooBarList'
OkB:
content:
application/json:
schema:
$ref: '#/components/schemas/FooBarList'
FooBarList:
type: object
description: List of FooBar
properties:
items:
type: array
items:
$ref: '#/components/schemas/FooBar'
FooBar:
type: object
required:
- codeIdn
- foo
- bar
properties:
codeIdn:
$ref: '#/components/schemas/CodeIdn'
foo:
$ref: '#/components/schemas/Foo'
bar:
$ref: '#/components/schemas/Bar'
The first defined endpoint foo/a works, but subsequent ones (foo/b , foo/c, foo/d...) throw error:
Request terminated with error: Error: Error: Prop not found: __bundled__ (#/__bundled__/codeIdn)
If I swap the order of definition, it's the other way around, always only the first defined endpoint works. The same happens with schemas other than FooBar that are referenced more than once.
Possible Workaround/Solution
I managed to fix our problem by overriding the peer dependency of prism/cli:
"overrides": {
"@stoplight/prism-cli": {
"@stoplight/json": "3.21.0"
}
},
"devDependencies": {
"@stoplight/prism-cli": "5.5.2",
},
Environment
- @stoplight/[email protected]
- OpenAPI v3.0.2, YAML.
- OS: Windows 10
- Tested both on Node.js v20.16.0 and v18.19.0
I can confirm the same issue, also encountered when updating @stoplight/prism-cli from 5.8 to 5.9 . It turns out that the @stoplight/json dependency is indeed the issue: version 3.21.0 works fine, but version 3.21.3 (and higher) give the above error, without changing other packages or the yml-file. It looks like the change was introduced in version 3.21.1 : https://github.com/stoplightio/json/pull/132 . The above workaround seems to work and would i.m.o. be the best short-term fix.