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.

enum type support

See original GitHub issue

It looks like typescript enum types are not supported yet in rsponse definition i set ConfigModel as type response like this

// model definition
export enum EnvConfig {
  PROD,
  DEV
}
export class ConfigModel {
  @IsString()
  @ApiModelProperty()
  domain: string;

  @IsInt()
  @ApiModelProperty()
  port: number;

  @ApiModelProperty()
  env: EnvConfig;
}

// controller
  @Post('api')
  @ApiResponse({status: 200, type: ConfigModel})
  api(@Body() data: ConfigModel): ConfigModel {
    return data;
  }

in the swagger-ui docs it’s represented as number:

ConfigModel {
  domain: string
  port: number
  env: number
}

it’s not supported or I did something wrong ?

I’m willing to help and do PR with this feature if anyone will point me in right direction

btw: grate job with the nestjs, i think it’s gonna by the best choice for node developers

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
kamilmysliwieccommented, Mar 30, 2018

PR #53 has been merged. I’ll publish it soon! 🙂

1reaction
Mencicommented, Jan 31, 2020

Now we have the plugin running in the compile time, could the plugin help us telling the enum values to Swagger? @fwoelffel

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation: 15: 8.7. Enumerated Types - PostgreSQL
Enumerated (enum) types are data types that comprise a static, ordered set of values. They are equivalent to the enum types supported in...
Read more >
enum — Support for enumerations — Python 3.11.1 ...
EnumType. The type for Enum and its subclasses. Enum. Base class for creating enumerated constants. IntEnum. Base class for creating enumerated constants ...
Read more >
MySQL 8.0 Reference Manual :: 11.3.5 The ENUM Type
An ENUM is a string object with a value chosen from a list of permitted values that are enumerated explicitly in the column...
Read more >
Enumeration types - C# reference - Microsoft Learn
An enumeration type (or enum type) is a value type defined by a set of named constants of the underlying integral numeric type....
Read more >
Enum Types - Java™ Tutorials
Note: All enums implicitly extend java.lang.Enum . Because a class can only extend one parent (see Declaring Classes), the Java language does not...
Read more >

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