-
Notifications
You must be signed in to change notification settings - Fork 489
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
@ApiProperty
with type: 'object'
does not compile in some cases
#3163
Comments
Correct What would you like to accomplish that's not doable with the current API? |
I'd like to express something similar to the minimum reproduction code: the property is of type object, and this object only defines class MyEntity {
@ApiProperty({
// This does not compile with version 8.
required: true, // In this example, `required` is `true`, but it could be `false` (in which case the property could have the value `undefined`).
type: 'object',
additionalProperties: { type: 'boolean' },
})
myObjectProperty: Record<string, bool>;
} title: MyEntity
type: object
properties:
myObjectProperty:
type: object
additionalProperties:
type: boolean
required:
- myObjectProperty Depending on the use case, I want to be able to declare |
Ah pardon me, I forgot to update the types to include the newly added |
Did you read the migration guide?
Is there an existing issue that is already proposing this?
Potential Commit/PR that introduced the regression
92df199
Versions
7.4.2 -> 8.0.0
Describe the regression
SchemaObjectMetadata
, which is used by the@ApiProperty
decorator, has become more restrictive. Previously,type
could be anystring
(amongst others). Now, if thetype
is'object'
, it must also provideproperties
, andrequired
applies to... the properties of the object itself?I would assume the minimum reproduction code is a valid JSONSchema. How do I express it using the
@ApiProperty
decorator?Minimum reproduction code
Expected behavior
The minimum reproduction code compiles.
Other
No response
The text was updated successfully, but these errors were encountered: