-
Notifications
You must be signed in to change notification settings - Fork 471
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
fix(core): isArray always false for enum arrays in plugin metadata #1696
base: master
Are you sure you want to change the base?
Conversation
@kamilmysliwiec is an enum array with 1 value supposed to have |
Oh, I ran into this.... |
This is the workaround we're using. This fixes the schema after generating the schema document. // Workaround for enum arrays
// https://github.com/nestjs/swagger/issues/1676
if (document?.components?.schemas) {
for (const schemaKey in document.components.schemas) {
const schema = document.components.schemas[schemaKey];
if (
'type' in schema &&
schema.type === 'object' &&
schema.properties
) {
for (const schemaPropKey in schema.properties) {
const property = schema.properties[schemaPropKey];
if ('items' in property && 'enum' in property) {
delete property.enum;
}
}
}
}
} |
… fix-enum-arrays-plugin
Thank you @ArielPrevu3D ! |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Enum arrays in plugin-generated metadata never have 'isArray' to
true
.Issue Number: 1676
What is the new behavior?
Enum arrays in plugin-generated metadata always have 'isArray' to
true
.Does this PR introduce a breaking change?
Other information