Skip to content

feat(filter): proposal about uuid validation#5394

Closed
jewome62 wants to merge 1 commit into
api-platform:mainfrom
jewome62:feature/filter-validation-uuid
Closed

feat(filter): proposal about uuid validation#5394
jewome62 wants to merge 1 commit into
api-platform:mainfrom
jewome62:feature/filter-validation-uuid

Conversation

@jewome62

@jewome62 jewome62 commented Feb 8, 2023

Copy link
Copy Markdown
Contributor
Q A
Branch? main
Tickets No ticket
License MIT
Doc PR proposal not documented yet

Situation :
Currently, if you filter on uuid typed field with SearchFilter and the uuid is not valid. You have a DriverException about SQL fail
(tested on Postgresql)

An exception occurred while executing a query: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type uuid: "bad-uuid"

Proposal :
Catch as the int validation, the bad uuid with hasValidValues

So firstly, what do you think about that ?
And secondly, do you have idea to manage Custom UUID type from third dependency (Ramsey or Symfony) for make DOCTRINE_UUID_TYPE constant.
And third, I did not see some test currently the hasValidValues behavior. Do you have some functional test about that ? I did not find them.

@jewome62
jewome62 force-pushed the feature/filter-validation-uuid branch from e50dff8 to 3b34276 Compare February 8, 2023 13:23
@soyuka

soyuka commented Feb 8, 2023

Copy link
Copy Markdown
Member

There's a feature called Query Parameter Validation (#1723) that should help you do exactly that but not a the query level. Maybe it is more appropriate? Sorry there aren't much documentation on the subject and there's an on-going process to improve that part.

@jewome62 jewome62 closed this Feb 18, 2023
@jewome62
jewome62 deleted the feature/filter-validation-uuid branch February 18, 2023 00:07
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