I changed $ref value several times,
but all of them reveal same error... help me plz
what's wrong?
swagger-ui error message
my directory image
swagger.js
import swaggereJsdoc from 'swagger-jsdoc';
const options = {
swaggerDefinition: {
info: {
title: 'User API',
version: '1.0.0',
description: 'User API with express',
},
host: 'localhost:8000',
// basePath: '/api',
},
apis: ['./routers/*.js', './swagger/*'],
};
export const specs = swaggereJsdoc(options);
user-router.js
/**
* @swagger
* /api/users:
* get:
* tags:
* - user
* description: users (array)
* produces:
* - application/json
* responses:
* '200':
* description: success getUsers
*
* schema:
* $ref: './swagger/user.yaml#/components/schemas/User'
*/
user.yaml
# /swagger/user.yml
components:
schemas:
User:
properties:
id:
type: integer
description: primary key
testing code before this question:
$ref: './swagger/user.yaml#/components/schemas/User'
$ref: '/swagger/user.yaml#/components/schemas/User'
$ref: 'swagger/user.yaml#/components/schemas/User'
$ref: './user.yaml#/components/schemas/User'
$ref: '/user.yaml#/components/schemas/User'
$ref: 'user.yaml#/components/schemas/User'