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

JSON validation fails for valid timestamps #265

Closed
lfrancke opened this issue Nov 1, 2023 · 6 comments
Closed

JSON validation fails for valid timestamps #265

lfrancke opened this issue Nov 1, 2023 · 6 comments

Comments

@lfrancke
Copy link

lfrancke commented Nov 1, 2023

Over in Rust land @jadamcrain opened an issue that our JSON files are invalid.

cyclonedx-cli fails on timestamps like 2022-12-21T23:54:20.218381200Z but it works if we chop off two digits at the end 2022-12-21T23:54:20.2183812Z

According to the JSON Schema timestamps are date-time fields which are RFC 3339 timestamps. The RFC doesn't specify a maximum number of fractional digits so both timestamps should be correct.

I'm not a .NET expert so take everything past this with a huge grain of salt:

  • cyclonedx-cli uses this library
  • This library uses JsonSchema.Net in version 3.3.2 as the dependency to do the actual validation
  • In version 4.0.1 of the library (current is 5.3.0) it added support for higher-precision timestamps

As such I suggest to update the dependency to a newer version.
I can submit a trivial PR to update the version number but as I have zero knowledge about .NET tools that might not be enough and it might not build.

@andreas-hilti
Copy link
Contributor

I think it will need some adjustments, based on the dependabot PR:
#264

@lfrancke
Copy link
Author

lfrancke commented Nov 6, 2023

Yeah, unfortunately, I don't know enough about .NET to be helpful in creating a PR for this :(

@andreas-hilti
Copy link
Contributor

I have created a PR to update JsonSchema.Net:
#272

@andreas-hilti
Copy link
Contributor

It validated successfully when a timestamp "2022-12-21T23:54:20.218381200Z" was used.

mtsfoni pushed a commit that referenced this issue May 19, 2024
#265

Update to newer version of JsonSchema.Net 
---------

Signed-off-by: andreas hilti <[email protected]>
@mtsfoni
Copy link
Contributor

mtsfoni commented May 21, 2024

Lars, it's finally done!

  • close

@mtsfoni mtsfoni closed this as completed May 21, 2024
@lfrancke
Copy link
Author

Thank you!

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