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

No matter the validation error, I still get generic Argument Validation Error message #1401

Closed
geauser opened this issue Dec 19, 2022 · 3 comments
Labels
Duplicate 🔑 This issue or pull request already exists

Comments

@geauser
Copy link

geauser commented Dec 19, 2022

Describe the Bug
When there is an error caught by class-validator decorators on @InputType() for mutations (example @MinLength), I only get a generic "Argument Validation Error" message.

Furthermore specifying a custom validation message as documented in class-validator doesn't change anything.

To Reproduce
I made a dedicated repo to reproduce the problem.

When the server is up, executes this query on http://localhost:4444/gql:

mutation { 
    addAccount(data: { name: "Invalid" }) { name }
}

Expected Behavior
I'd expect to see the validation message set for the given class-validator decorator (or the default one).

Logs

{
    "errors": [
        {
            "message": "Argument Validation Error",
            "locations": [
                {
                    "line": 2,
                    "column": 5
                }
            ],
            "path": [
                "addAccount"
            ]
        }
    ],
    "data": null
}

Environment

  • OS: MacOS 12.4 Monterey
  • Node v16.13.2
  • Package version ^2.0.0-beta.1
  • TypeScript version ^4.9.4
@MichalLytek
Copy link
Owner

Is it a duplicate of #1396 ?

@MichalLytek MichalLytek added the Question ❔ Not future request, proposal or bug issue label Dec 19, 2022
@geauser
Copy link
Author

geauser commented Dec 19, 2022

Hmm does not seem like it. Passing { forbidUnknownValues: false } changes nothing.

@carlocorradini
Copy link
Contributor

Duplicate of #1397
The GraphQL error encapsulates the original error.
You must create a custom function (formatError) when building an Apollo server instance.
It's all described in this comment: #1397 (comment)

@MichalLytek MichalLytek added Duplicate 🔑 This issue or pull request already exists and removed Question ❔ Not future request, proposal or bug issue labels Dec 20, 2022
lcpnine added a commit to lcpnine/lifeleader that referenced this issue Jan 25, 2024
lcpnine added a commit to lcpnine/lifeleader that referenced this issue Jan 25, 2024
* ✨ Add mandala model

* ♻️ Change way to export

* ✨ Add default value

* ✨ Add mandala chart resolver

* ✨ Save title and description on mandala chart document, not cell

* ✨ Add dto for creating mandala chart

* ✨ Add dto for updating mandala chart

* ✨ Add dto for deleting mandala chart

* 🔥 Remove message field from success type

* ✨ Add dto for Getting mandala chart

* ✨ Add resolver for mandala chart

* ♻️ Fix type error

* ✨ Change goals to goal per one mandala cell

* ✨ Add getting user id decorator for resolver

* ✨ Add return type of failure

* ✨ Get userId from cookie on saving

* ✨ Add private field and fix wrong type

* ✨ Imbed mandala cell into mandala chart

* ✨ Add private fields on input

* ✨ Change update input

* 🐛 Remove true in for loop on validation function

* ✨ Replace impossible decorator to middleware

* 🔧 Fix eslintrc error

* ✨ Set temporary ignore

* 🐛 Fix error on type graphql

MichalLytek/type-graphql#1401

* ♻️ Change error without login

* ✨ Apply userId middleware

* ✨ Set proper error type
lcpnine added a commit to lcpnine/lifeleader that referenced this issue Jan 28, 2024
* [Resolver] Add mandala chart related resolver (#21)

* ✨ Add mandala model

* ♻️ Change way to export

* ✨ Add default value

* ✨ Add mandala chart resolver

* ✨ Save title and description on mandala chart document, not cell

* ✨ Add dto for creating mandala chart

* ✨ Add dto for updating mandala chart

* ✨ Add dto for deleting mandala chart

* 🔥 Remove message field from success type

* ✨ Add dto for Getting mandala chart

* ✨ Add resolver for mandala chart

* ♻️ Fix type error

* ✨ Change goals to goal per one mandala cell

* ✨ Add getting user id decorator for resolver

* ✨ Add return type of failure

* ✨ Get userId from cookie on saving

* ✨ Add private field and fix wrong type

* ✨ Imbed mandala cell into mandala chart

* ✨ Add private fields on input

* ✨ Change update input

* 🐛 Remove true in for loop on validation function

* ✨ Replace impossible decorator to middleware

* 🔧 Fix eslintrc error

* ✨ Set temporary ignore

* 🐛 Fix error on type graphql

MichalLytek/type-graphql#1401

* ♻️ Change error without login

* ✨ Apply userId middleware

* ✨ Set proper error type

* [Graphql] Apply changed type of mandala chart on web (#22)

* 🔥 Remove grid

* ✨ Set mock data for dev

* ✨ Show placeholder

* ✨ Add isGridValid

* 🚚 Move screenshot button

* ✨ Add load and save button

* ✨ Add buttons

* ✨ Apply i18n

* 🚚 Move mandala chart section to reuse

* 💄 Change gap between grid

* 💄 Change text style of the center square

* 💄 Add style on displaying mandala chart

* ✨ Seperate default value

* 🚚 Move ai recommendation query hook

* 🚚 Seperate switch

* ✨ Change update mandala chart input type

* ♻️ Add more var

* 🚧 Change whole grid value type

* 🚧 Change displaying full view mandala chart type with graphql type

* 🚧 Change use ai recommendation type with graphql type

* ✨ Changed type for mandala chart

* 🐛 Fix handle manually function

* 🐛 Fix handle ai function

* 🐛 Fix set ai mode

* 💄 Set opacity

* 🐛 Fix wrong dev value

* 🔥 Remove test value

* 🔥 Remove dev value

* 🐛 Fix opacity

* ✨ Add keyboard event

* [Web] Add mandala chart list page (#23)

* ✨ Add getUserMandalaCharts query

* ✨ Send filtered mandala charts

* ✨ Make mandala chart description nullable

* ✨ Get mandala charts

* ✨ Add variables to query

🔥 Remove unnecessary console

* 💄 Add icon

* 💄 Add lock icon

* ✨ Add created at and modified at date

* ✨ Make last modified at non essential

* ✨ Add created updated information

* ✨ Set sign in

✨ Connect to sign in page when click loading saved charts button

* ✨ Apply delete mutation

* ✨ Add no content

* 💄 Change style

* ✨ Set link to mandala chart page

* [Save] Add save and load feature (#24)

* 🚚 Copy index page to chart page

* 🔥 Remove no mandala charts

* ♻️ Change props

* ✨ Add query on the chart page

* ✨ Skip if no chart id exist

* 🔥 Remove unnecessary var

* ✨ Add error type

* ✨ Add Title and Description component

* ✨ Add title and description edit on chart

* ✨ Update response type of mandala chart

* 🔥 Remove unnecessary handler function and vars

* ✨ Make create button to save in server

* 🔥 Remove duplicated variables input

* ✨ Add alert for network work

* 🐛 Remove as option

* ✨ Change input type of update

* ♻️ Apply changed chart id

* 🔥 Remove typename to prevent error

* ✨ Change phrase

* ✨ Add private button

* ✨ Prevent request if there is no title

* 🔥 Remove dev default value

* ✨ Make use go to can keep the params

* ✨ Add temp save

* 🐛 Fix wrong condition

* ✨ Update chart will show alert

* [i18n] Apply i18n (#25)

* ✨ Change home page to explain about website and mandala chart

* 💄 Change header style

* ✨ Control font size on mobile

* 🐛 Control font size on mobile

* ✨ Add sidebar

* ✨ Remove menus from mobile and move to sign out

* ✨ Add icons

* ✨ Make sidebar cover the page

* ✨ Add sign in out on nav bar

* 🚚 Move layout realted file into a file

* :turck: Change file name

* ✨ Apply i18n on layout

* 🚚 Move values to common i18n

* ✨ Apply i18n on my list

* 💄 Fix style

* 💄 Change displaying mandala chart style

* ✨ Add pupetter for screenshot on server

* ✨ Get screenshot on the client

* ✨ Add styles on public

* ✨ Change scripts

* ✨ Get screenshot from server

* ✨ Get proper size image

* ✨ Add example charts

* 🔥 Show placeholder on display too

* ✨ Add empty example

* 💄 Change align

* ✨ Apply handle function

* ✨ Do not show sign up or sign in if it's already signed in

* ✨ Add i18n on index page

* 💄 Change style

* ♻️ Change i18n

* ✨ Change build command

* ♻️ Change i18n

* ✨ Add number

* ✨ Add notice

* ✨ Comment AI mode switch

* ✨ Do not open when grid is not valid

* ✨ Add focus to prevent escaping

* ✨ Add border for focused square

* ✨ Prevent ai recommend

* ✨ Add colors on highlight box
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate 🔑 This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants