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

fix(swagger): improve rendering of array items #3255

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ccaspers
Copy link
Contributor

@ccaspers ccaspers commented Jan 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?

When documenting items in arrays, minLength and maxLength will not be rendered.

Issue Number: #3207

What is the new behavior?

minLength and maxLength can now be used to document items in arrays.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@ccaspers ccaspers changed the title fix(swagger): improve rendering of arrays fix(swagger): improve rendering of array items Jan 20, 2025
? { type: (items as any).type, ...modifierProperties }
: { ...(items as any).type, ...modifierProperties }
? { type: (items as any).type, ...modifierProperties, ...items }
: { ...(items as any).type, ...modifierProperties, ...items }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...items will override type here (when type is not string)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true. But this will only happen, if the user decided to manually add a type to items like this for example:

@ApiProperty({
  items: {
    type: 'string',
  }
})

I would argue that this is the desired behavior, but I'll look into it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have seen this fairly often in the past

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