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

Data Type Format validation #139

Open
baurceanu opened this issue Dec 17, 2020 · 7 comments
Open

Data Type Format validation #139

baurceanu opened this issue Dec 17, 2020 · 7 comments

Comments

@baurceanu
Copy link
Contributor

Hi, it might be an option to add validation of data type format.
Use case:
Date time format validation.
On my current project we use custom formats (not ISO / RFC). So I'd like to have something like this in configuration:

<configuration>
    <validateDataTypeFormat>true</validateDataTypeFormat>
    <customDataTypeFormats>
        <customDataTypeFormat>my-date-time</customDataTypeFormat> 
    </customDataTypeFormats>
    <forbiddenDataTypeFormats>
        <forbiddenDataTypeFormat>date-time<forbiddenDataTypeFormat>
    </forbiddenDataTypeFormats>
</configuration>

By default all standard OAS formats are allowed and all custom formats are forbidden.

Valid schema:

User:
  type: object
  properties:
    birthDateTime:
      type: string
      format: my-date-time

Not valid schema:

User:
  type: object
  properties:
    birthDateTime:
      type: string
      format: date-time
@JFCote
Copy link
Member

JFCote commented Dec 18, 2020

Hi @baurchanu ,

Thanks for the suggestion. I'll look into it in 2021. For the moment, the configuration of openapi-style-validator is very simple, with only 9 boolean flags and we want to keep it that way but like you said, the default could be like it is today and we could add more options for situations like that.

By the way, if you have time to create a PR for this, I will take the time to review it and merge it if everything is ok.
Thanks

@baurceanu
Copy link
Contributor Author

ok, i'll try to implement this and create a PR

@JFCote
Copy link
Member

JFCote commented Jan 5, 2021

Hi @baurchanu ,

Did you start something for this? Just coming back from the holidays and wanted to know if you had something (no pressure! ).
Thanks!

@baurceanu
Copy link
Contributor Author

baurceanu commented Jan 28, 2021

@JFCote hi, yes I've examined the project and working on this issue. Sorry for the delay. We have too long and discouraging new year holidays in Russia :)

@JFCote
Copy link
Member

JFCote commented Jan 29, 2021

@baurchanu No problem, take your time!

@baurceanu
Copy link
Contributor Author

Sorry, I'm not planning to implement this feature anymore, 'cause I migrated my project to zally.

@JFCote
Copy link
Member

JFCote commented Jul 27, 2021

@baurchanu Looks like a nice project! Thanks for letting me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants