Skip to content

Conversation

mag123c
Copy link
Contributor

@mag123c mag123c commented Oct 18, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

The format field in @ApiProperty() accepts any string value, which allows for invalid or misspelled values without any feedback from the TypeScript compiler.

Issue Number: #3508

What is the new behavior?

Added SchemaObjectFormat type that

  • Provides IDE autocomplete for OpenAPI-defined standard formats (int32, int64, float, double, byte, binary, date, date-time, password)
  • Includes commonly used formats (email, uuid, uri, hostname, ipv4, ipv6)
  • Maintains full backward compatibility by allowing custom format values via (string & {}) pattern
@ApiProperty({ format: 'date-time' })  // Autocomplete + type checking
createdAt: Date;

@ApiProperty({ format: 'custom-format' })  // Still works (backward compatible)
customField: string;

The (string & {}) pattern ensures all existing custom format values continue to work while providing autocomplete for standard formats.

Does this PR introduce a breaking change?

  • Yes
  • No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants