Skip to content

Controller Annotations #7

Discussion options

You must be logged in to vote

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:

  • The controller annotation must be always placed at the begining of the file
  • The method annotation is always required right above your controller functions
  • Annotations must be enabled in configuration

Below I'm leaving the files I used to try to reproduce the situation:

  • Controller file
/** @oastools {Controller} /agent */

/**
 * @oastools {method} GET
 */
module.exports.getAgent  = function getAgent (req, res) {
    res.send({message: "mockup"})
}
  • OAS yaml declaration
openapi: 3.0.0

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jeffreybradley1963
Comment options

Answer selected by jeffreybradley1963
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants