Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Using regular expression from refined type#

Sumit Rawal answered on May 24, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers


Using regular expression from refined type#

0

If we take a look at the code within the tapir library, we see that the Schema and SchemaFor code, which is used for codecs does not yet support a dedicated UUID type. There is a detour for it using Schema.SString.

Currently, there is active discussion about changing and extending the schema code in tapir regarding more future possibilities and better documentation options.

Now, we look a bit further into the OpenAPI code and find that it supports several interesting attributes that we might use. For now, we will stick to the attribute pattern of the Schema class in that part. It is intended to hold a pattern (regular expression) that describes the format of a string type. We need to define some (or better, exactly 2) regular expressions. We already have one for our language code!

How do we use the existing regular expression from our refined type? Using some shapeless magic, we might use an implicit Witness, which should be provided by our refined type.

Popularity 1/10 Helpfulness 1/10 Language javascript
Source: Grepper
Link to this answer
Share Copy Link
Contributed on May 24 2023
Sumit Rawal
0 Answers  Avg Quality 2/10


X

Continue with Google

By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
X
Grepper Account Login Required

Oops, You will need to install Grepper and log-in to perform this action.