Currently, I am trying to implement Swagger UI for my Next.JS project with APIs. However, the module is returning this error: (Error: Cannot convert undefined or null to object).
The following is one of my swagger notation just in case if this is the problem.
`/**
- @swagger
- /api/user/users:
- get:
-
summary: Get users for a given semester and year or the active semester
-
description: Retrieves all users for a specified semester and year or the active semester if no semester and year are provided.
-
parameters:
-
- in: query
-
name: semester
-
schema:
-
type: string
-
required: false
-
description: The semester to fetch users for (1 or 2).
-
- in: query
-
name: year
-
schema:
-
type: string
-
required: false
-
description: The year to fetch users for (e.g., '2023').
-
responses:
-
200:
-
description: A list of users
-
content:
-
application/json:
-
schema:
-
type: array
-
items:
-
type: object
-
properties:
-
id:
-
type: string
-
// Add other user properties here
-
400:
-
description: Invalid semester or year
-
404:
-
description: No active semester found
-
405:
-
description: Method not allowed
-
500:
-
description: Error fetching users
*/`
I have followed step by step from the Github page, but it is still causing that. I also have tried with swagger-jsdoc, but it seems to be the same problem, suggesting that the problem is originating from swagger-jsdoc module.
Github Page
TooSalty is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.