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

[BUG] Nested property in body schema causes an unavoidable 500 error #148

Closed
Luisetepe opened this issue Sep 14, 2023 · 2 comments
Closed

Comments

@Luisetepe
Copy link

Hi! I think I have encountered a problem that I don't know how to resolve.

If I declare a property of type Object inside the top level object of the "body" schema:

body: t.Object({
                name: t.String(),
                pvp: t.Numeric(),
                categoryId: t.Optional(t.Numeric()),
                useless: t.Optional(
                    t.Object({
                        useless1: t.String(),
                        useless2: t.Numeric()
                    })
                )
            }),

That endpoint becomes impossible to reach if, in this case the useless property, is totally absent from the JSON body

image

I don't know how the internals work of course, but may a conditional access (?.) in the validation code could fix this.

@SaltyAom
Copy link
Member

This should be fixed in 0.7 by the removal manual extractor #103.

Let me know if the issue still persists

@Luisetepe
Copy link
Author

This is fixed in [email protected]

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

No branches or pull requests

2 participants