Skip to content

Prop not found #146

Open
Open
@jasp3rb

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions