Controller Annotations #7
-
I have not been able to get the Controller Annotations to work. In my file I have tried
and I've tried
When I run the app, I get This seems to follow the documentation to the letter. My swagger file for /agent is
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello, I just initialized a new server with
Below I'm leaving the files I used to try to reproduce the situation:
/** @oastools {Controller} /agent */
/**
* @oastools {method} GET
*/
module.exports.getAgent = function getAgent (req, res) {
res.send({message: "mockup"})
}
openapi: 3.0.0
info:
version: 0.1.0
title: Data Service
paths:
'/agent':
get:
summary: Get upgrade agent installler
description: Return the agent installer
responses:
'200':
description: successful operation
content:
application/octet-stream:
schema:
type: string
format: binary
default:
description: Unexpected error
content:
application/json:
schema:
type: string
{
"packageJSON": "package.json",
"oasFile": "api/oas.yaml",
"useAnnotations": true,
"logger": {
"customLogger": null,
"level": "info",
"logFile": false,
"logFilePath": "./logs/oas-tools.log"
},
"middleware": {
"router": { "disable": false, "controllers": "./controllers" },
"validator": { "requestValidation": true, "responseValidation": true, "strict": false },
"security": { "disable": true, "auth": null },
"swagger": { "disable": false, "path": "/docs", "ui": { "customCss": null, "customJs": null } },
"error": { "disable": false, "printStackTrace": false, "customHandler": null }
}
} I hope this can help you out, but bear in mind that annotations are experimental and may change in the future, to be more specific, they are likely to be replaced by Javascript decorators. |
Beta Was this translation helpful? Give feedback.
Hello, I just initialized a new server with
@oas-tools/cli
using your OAS declaration and copied your controller, but I couldn't reproduce the error. When using annotation you must take into account that:Below I'm leaving the files I used to try to reproduce the situation: