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

some string are inferred as "format":"style" #23

Open
IdoWeitzman opened this issue Aug 16, 2022 · 0 comments
Open

some string are inferred as "format":"style" #23

IdoWeitzman opened this issue Aug 16, 2022 · 0 comments

Comments

@IdoWeitzman
Copy link

strings which are not "style" are inferred as styles.
for example, given this code:

import toJsonSchema from 'to-json-schema'

const json = {
  'notAStyle': '10:00',
}

console.log(toJsonSchema(json))

the following json schema is generated:
{
"type": "object",
"properties": {
"notAStyle": {
"type": "string",
"format": "style"
}
}
}

I think the regex here can be improved to avoid this mistakes: https://github.com/ruzicka/to-json-schema/blob/master/src/jsonSchemaHelpers.js#L74

I would love to upload PR for this one if possible

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

No branches or pull requests

1 participant