Skip to content

Yaml Reference to external url not working #2708

@PratMoha

Description

@PratMoha

I'm using a yaml reference in oas which is failing to create mock with below reference.

Error:
      $ref: 'https://opensource.zalando.com/restful-api-guidelines/models/problem-1.0.1.yaml#Problem'

Is prism rely on json reference only and not yaml reference?

Current Behavior

Failing with below error:

{
  stack: 'ResolverError: Error downloading https://opensource.zalando.com/restful-api-guidelines/models/problem-1.0.1.yaml \n' +
    'RequestInit: Expected signal ("AbortSignal {\n' +
    '  eventEmitter: EventEmitter {\n' +
    '    _events: [Object: null prototype] {},\n' +
    '    _eventsCount: 0,\n' +
    '    _maxListeners: undefined,\n' +
    '    Symbol(shapeMode): false,\n' +
    '    Symbol(kCapture): false\n' +
    '  },\n' +
    '  onabort: null,\n' +
    '  aborted: false,\n' +
    '  reason: undefined\n' +
    '}") to be an instance of AbortSignal.\n' +
    '    at download ({PATH}\\node_modules\\@stoplight\\prism-cli\\node_modules\\@stoplight\\json-schema-ref-parser\\lib\\resolvers\\http.js:175:11)',
  code: 'ERESOLVER',
  message: 'Error downloading https://opensource.zalando.com/restful-api-guidelines/models/problem-1.0.1.yaml \n' +     
    'RequestInit: Expected signal ("AbortSignal {\n' +
    '  eventEmitter: EventEmitter {\n' +
    '    _events: [Object: null prototype] {},\n' +
    '    _eventsCount: 0,\n' +
    '    _maxListeners: undefined,\n' +
    '    Symbol(shapeMode): false,\n' +
    '  eventEmitter: EventEmitter {\n' +
    '    _events: [Object: null prototype] {},\n' +
    '    _eventsCount: 0,\n' +
    '    _maxListeners: undefined,\n' +
    '    Symbol(shapeMode): false,\n' +
    '    _eventsCount: 0,\n' +
    '    _maxListeners: undefined,\n' +
    '    Symbol(shapeMode): false,\n' +
    '    Symbol(shapeMode): false,\n' +
    '    Symbol(kCapture): false\n' +
    '  },\n' +
    '  onabort: null,\n' +
    '  aborted: false,\n' +
    '  reason: undefined\n' +
    '}") to be an instance of AbortSignal.',
  source: 'https://opensource.zalando.com/restful-api-guidelines/models/problem-1.0.1.yaml',
  path: null,
  toJSON: [Function: toJSON],
  name: 'ResolverError',
  toString: [Function: toString]
}

Expected Behavior

Accepts the yaml file

Steps to Reproduce

  1. Add zalando external reference for testing to any yaml oas and run prism mock command.
  • Version used: prism : 5.14.2, node: v24.4.1
  • Environment name and version:
  • Operating System and version (desktop or mobile): Windows

Metadata

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