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.

Hidden Controller referencing model should not generate model

See original GitHub issue

First of all, we love using tsoa. Thank you!

Today, when a hidden controller references a model / schema, it is included in the final output. This does not seem like it would be intended behavior.

Sorting

  • I’m submitting a …

    • bug report
    • feature request
    • support request
  • I confirm that I

    • used the search to make sure that a similar issue hasn’t already been submit

Expected Behavior

When running yarn tsoa spec, you should get this:

components:
    examples: {}
    headers: {}
    parameters: {}
    requestBodies: {}
    responses: {}
    schemas: {}
    securitySchemes:
        basic:
            scheme: basic
            type: http
info:
    title: api
    version: 0.1.0
    contact: {}
openapi: 3.0.0
paths: {}
servers:
    -
        url: /v0

Current Behavior

When running yarn tsoa spec, you get this:

components:
    examples: {}
    headers: {}
    parameters: {}
    requestBodies: {}
    responses: {}
    schemas:
        TestPayload:
            properties:
                key:
                    type: string
            required:
                - key
            type: object
    securitySchemes:
        basic:
            scheme: basic
            type: http
info:
    title: api
    version: 0.1.0
    contact: {}
openapi: 3.0.0
paths: {}
servers:
    -
        url: /v0

Possible Solution

Ideally, it would be possible to use @Hidden on the model or the @ignore jsdoc, but neither seem to work for me.

Steps to Reproduce

Controller example:

import { Hidden, Route, Controller, Get } from 'tsoa';

type TestPayload = {
  key: string;
};

@Hidden()
@Route('test')
export class TestController extends Controller {
  @Get()
  async route(): Promise<TestPayload> {
    return {
      key: 'value',
    };
  }
}

Context (Environment)

Version of the library: Version of NodeJS:

  • Confirm you were using yarn not npm: [x]

Detailed Description

Should not find any metadata from hidden controllers

Breaking change?

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
jackey8616commented, Oct 7, 2022

@marcusglowe The feature you want is, Hiding models which been use in a Hidden controller ?

I’m planning to send a PR about this.
I think we need discuss more detail about this, and find out some way to implement this.

0reactions
marcusglowecommented, Oct 7, 2022

Yes that’s right!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compile error in hidden module: <module name>
The error is raised when a compilation error exists in the VBA code inside a protected (hidden) module. The specific compilation error is...
Read more >
Hide a Request Field in Swagger API - Baeldung
We can use the hidden property of the annotation to hide a field in the definition of a model object in Swagger UI....
Read more >
Using OpenAPI and Swagger UI - Quarkus
This guide explains how your Quarkus application can expose its API description through an OpenAPI specification and how you can test it via...
Read more >
<model-viewer> Examples and Documentation
This attribute controls when the model should be revealed. If reveal is set to "auto", the model will be revealed as soon as...
Read more >
F.A.Q - Springdoc-openapi
Can springdoc-openapi generate API only for @RestController ? ... The property springdoc.model-converters.pageable-converter.enabled is only available since ...
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