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

Support for different content with the same http code. #781

Open
2 tasks done
pedropmartiniano opened this issue Jan 22, 2024 · 1 comment
Open
2 tasks done

Support for different content with the same http code. #781

pedropmartiniano opened this issue Jan 22, 2024 · 1 comment

Comments

@pedropmartiniano
Copy link

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

4.23.2

Plugin version

8.14.0

Node.js version

20.10.0

Operating system

Linux

Operating system version (i.e. 20.04, 11.3, 10)

20.04

Description

I'm using the oneOf in my schema, but it's not working how it should be, he just replace the return of my endpoint with the first return properties of my oneOf.

Steps to Reproduce

200: {
            description: 'Successful response',
            oneOf: [
                {
                    type: 'object',
                    properties: {
                        success: { type: 'boolean', example: true },
                        data: {
                            type: 'array',
                            items: {
                                type: 'object',
                                properties: {
                                    id: { type: 'string' },
                                    id_usuario: { type: 'string' },
                                    id_posto: { type: 'string' }
                                }
                            }
                        }
                    }
                },
                {
                    type: 'object',
                    properties: {
                        success: { type: 'boolean', example: true },
                        message: {
                            type: 'string'
                        }
                    }
                },
            ]
        },

Expected Behavior

No response

@mcollina
Copy link
Member

Thanks for reporting!

Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.

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