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: use type variable since rest.type is always undefined #107

Merged
merged 1 commit into from Mar 20, 2024

Conversation

aleclarson
Copy link
Contributor

@aleclarson aleclarson commented Mar 16, 2024

You can see below that type is removed from rest using the destructure syntax.

elysia-swagger/src/utils.ts

Lines 182 to 208 in 12ec0e1

const {
type,
properties,
required,
additionalProperties,
...rest
} = value as typeof value & {
type: string
properties: Object
required: string[]
}
responseSchema[key] = {
...rest,
description: rest.description as any,
content: mapTypesResponse(
contentTypes,
rest.type === 'object' || rest.type === 'array'
? ({
type: rest.type,
properties,
items: value.items,
required
} as any)
: value
)
}

@marclave marclave self-requested a review March 20, 2024 06:31
Copy link
Collaborator

@marclave marclave left a comment

Choose a reason for hiding this comment

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

nice fix @aleclarson ! and first time contribution 🎊

@marclave
Copy link
Collaborator

will get this in soon! just confirming with @SaltyAom on the best merge strategy (squash vs rebase vs merge commit) ✨

@marclave marclave merged commit df7abe1 into elysiajs:main Mar 20, 2024
1 check passed
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.

None yet

2 participants