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

Implement JSON schema field constraints #567

Merged
merged 1 commit into from
Jan 23, 2024
Merged

Conversation

aschwa
Copy link
Contributor

@aschwa aschwa commented Jan 22, 2024

Add JSON schema field constraints addressing #215

So far this PR includes:

  • date-time
  • time
  • date
  • UUID

@rlouf rlouf marked this pull request as ready for review January 23, 2024 09:19
@rlouf rlouf force-pushed the aaron_json branch 3 times, most recently from 8b7b234 to fda4ce4 Compare January 23, 2024 14:56
@rlouf rlouf merged commit c5714fa into outlines-dev:main Jan 23, 2024
5 checks passed
Comment on lines +27 to +30
DATE_TIME = r"(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(\.[0-9]{3})?(Z)?"
DATE = r"(?:\d{4})-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])"
TIME = r"(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(\\.[0-9]+)?(Z)?"
UUID = r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
Copy link

@ash211 ash211 Apr 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these constants have literal " wrapping them, like how on L13 STRING is wrapping STRING_INNER in double-quote characters?

I think this may be causing the bug observed at predibase/lorax#392 where it's producing invalid json like this

{"key": 2022-02-02}

instead of

{"key": "2022-02-02"}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Happy to quickly review and merge a PR that fixes this :)

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.

None yet

3 participants