Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support "Uppercase<string>" and "Lowercase<string>" by treating them as normal strings #2606

Closed
1 task done
bc-m opened this issue Sep 8, 2023 · 0 comments · Fixed by #2608
Closed
1 task done
Labels

Comments

@bc-m
Copy link

bc-m commented Sep 8, 2023

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

Our API exchanges data between several systems. One of the differences between these systems is that one of them uses lowerstring-uuids and the other one uses upperstring-uuids. So we want to declare these IDs as "Uppercase" or "Lowercase" via typescript in there classes.

When using the Swagger-Plugin there recognized as "{}" and the Swagger-Plugin for TS-Jest throws with A circular dependency has been detected (property key: "id"). Please, make sure that each side of a bidirectional relationships are using lazy resolvers ("type: () => ClassType").

Describe the solution you'd like

It would be great if the Swagger plugin would treat "Uppercase" and "Lowercase" as normal strings.

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

Reduce boilerplate.

Currently:

import { ApiProperty } from '@nestjs/swagger';

export class CatDto {
  @ApiProperty({ type: String })
  id!: Uppercase<string>
}

With wished feature:

export class CatDto {
  id!: Uppercase<string>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant