[ 
https://issues.apache.org/jira/browse/SOLR-18238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18088744#comment-18088744
 ] 

Eric Pugh commented on SOLR-18238:
----------------------------------

I take inspiration from teh greatest web dev framework ever, Ruby on Rails ;-). 
  WWRoRD: What Would Ruby on Rails Do?  

What I love is that they have a very strong conventions for how to do 
validations that are easily applied.   In our world, I have to rethink on every 
single API how validation happens, and each API has it's own validation code, 
nothing shared.   We should have a shared set of validation primitives like "is 
null allowed?, "is a string", "is a number" etc that can easily be added to our 
APIS.  And then of course a nice way to provide a custom one off one.

Then, we can have our unit testing of validations be targeted to that shared 
code, instead of weird mix of both system/integraiotn level validation logic 
and unit testing all mixed up on each API.

I am quite surprised that JAX RS doesn't provide out of the box a lot of the 
primitive validations...   I've looked, and didn't see them,, outside of "bean 
validation", which seems like a lot, but maybe something to look at?

I am cc;ing [~gerlowskija] as he has probably done the most thinking about the 
V2 apis!

> Add Stronger Validation to V2 API Parameters
> --------------------------------------------
>
>                 Key: SOLR-18238
>                 URL: https://issues.apache.org/jira/browse/SOLR-18238
>             Project: Solr
>          Issue Type: Bug
>          Components: v2 API
>    Affects Versions: 10.0
>            Reporter: Eric Pugh
>            Priority: Minor
>
> We have very inconsistent validation across our V2 apis for things like 
> pathParam and queryParams.   For example, I recently discovered that in the 
> ConfigSets API DELETE it would accept a "     " as a configset name!   
> It would be interesting to explore if we could have some validation that 
> worked across our Java v2 apis, and maybe could also be used by the Solr UI 
> as well.   
>  
> I can imagine:
>  * Investigating the Jax RS Bean validation code.
>  * Establishing much stronger patterns in our own Java API code that 
> validates using the same util methods across all APIS (strong patterns make 
> it easier for the next person to do the right thing)
>  * Something around generating validation code in the OpenAPI spec generated 
> language clients?
>  
> This would be a great ticket for someone familiar with modern web dev 
> techniques to contribute to Solr!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to