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

null error when data is passed "null" when adding addFormat or defineKeword #278

Open
geetikabeskhiyar opened this issue Oct 11, 2021 · 1 comment

Comments

@geetikabeskhiyar
Copy link

@geraintluff, introduced a custom format to accept null or any accepted data type as input value. But somewhere in the tv4 code the null check is being executed even before it actually checks for the format and hence tv4 throws a null error before checking the custom format.
Can any changes be done to move the null check in the library in such a way that addFormat or defineKeword do not throw error even if we send null as the data.

@geetikabeskhiyar
Copy link
Author

geetikabeskhiyar commented Oct 11, 2021

To overcome this I have for now removed the type field from the swagger and added a custom format without the type field details. Custom created a format and checked null and type of data inside the custom format method.
By doing this, code does not break since type is not present and passes for the fields whose value is null in the Request body and are non mandatory as per swagger and for whom the format is mentioned as the custom format in the swagger spec 2.0.

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