question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resolver error at paths./users.get.responses.200.schema.$ref

See original GitHub issue

I keep getting this error:

Resolver error at paths./users.get.responses.200.schema.$ref
Could not resolve reference because of: Could not resolve pointer: /definitions/users list does not exist in document

Here is the code.

module.exports = function (app) {

  const paginate = app.get('paginate');

  let swaggerDocs = {
    description: 'Service for managing users',
    definitions: {
      users: {
        "type": "object",
        "required": [
          "username",
          "password"
        ],
        "properties": {
          "username": {
            "type": "string",
            "description": "The email of the user"
          },
          "password": {
            "type": "string",
            "description": "The password of the user for figo."
          }
        }
      }
    }

  }
  const options = {
    name: 'users',
    paginate,
    app: app
  };

  // Initialize our service with any options it requires
  app.use('/users', Object.assign(createService(options), { docs: swaggerDocs }));

  // Get our initialized service so that we can register hooks and filters
  const service = app.service('users');

  service.hooks(hooks);

};

What am I missing?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Mairucommented, May 24, 2019

When adding definitions with the service.docs.definitions option instead of service.docs.definition you have to define the list definition yourself with correct schema as ref or object. See examples how to do it.

1reaction
binarytracercommented, Feb 6, 2018
  const serviceInstance = createService(options);
  serviceInstance.docs = {

    description: 'list of users',
    definitions: {
      users: {
        'type': 'object',
        'required': [
          'username', 'password'
        ],
        'properties': {
          'username': {
            'type': 'string',
            'description': 'user username'
          },
          'email': {
            'type': 'string',
            'description': 'The email address of the user'
          },
          'password': {
            'type': 'string',
            'description': 'encrypted password of the user'
          }
        }
      },
      'users list': {
        'type': 'array'
      }
    }
  };

i think the only missing is ‘users list’, part. I hope im right.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Swagger Resolver error, Could not resolve reference
Could not resolve reference:... in my case. The error was: Errors Hide Resolver error at paths./api/v1/Account/IsTenantAvailable.post.responses.
Read more >
Swagger $ref gives "Could not resolve reference: u...
Errors Resolver error at paths./api/thing.get.responses.200.content.application/json.schema.$ref Could not resolve reference: undefined ...
Read more >
Paths and Operations - Swagger
A single path can support multiple operations, for example, GET /users to get a list ... responses: 200: description: OK; schema: $ref: '#/definitions/User' ......
Read more >
Swagger UI fails to find a section in $ref if it contains escaped ...
ref Could not resolve reference: #/components/schemas/~1persons ... version: 1.0.0 paths: '/persons': get: responses: 200: description: test ...
Read more >
"Swagger Resolver" Errors in later versions of Reff app
Resolver error <small> at paths./attachment.post.parameters.0.schema.$ref</small> Could not resolve reference because of: Could not resolve ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found