-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Fix driver schema json default type requirements #9674
Fix driver schema json default type requirements #9674
Conversation
Thanks! Since you discovered this as a user, I think this should have a changelog entry. Incidentally, how did you discover it? Because the script throws an error on your valid JSON file? (We should have better tests, but I'm afraid this won't happen for a while, and we don't even have the infrastructure to add a non-regression test.) |
@gilles-peskine-arm yes I noticed it, while I was using the schemah, for creating a json file. It throws an error if the previous suggested const value is between bracket, because it is supposed to be string by the schema. If it is just between the quotes, it will show a warning, that it should be the predefined const value between brackets. |
In both of the examples it is only shown as a simple string, and not as an array. |
7bcaceb
to
cb42454
Compare
I added a changelog. |
* Fix type definition's default value in driver_*_schema.json. Also removes | ||
warning, if the right string definition is used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The audience of changelog entries is users. The entry currently describes the content of the patch, but not what it means from a user's perspective. Something like this:
Fix a warning about an invalid JSON schema when running generate_driver_wrappers.py.
Although I can't reproduce the warning here, even though running scripts/generate_driver_wrappers.py
with default options should load our bundled drivers (test and p256-m) which do have a "type"
property that is incorrectly described in the schema.
Note that I agree that your patch is correct. I'm just wondering why you're getting an error due to the current invalid schema and I'm not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure about how generate_driver_wrappers.py
works, and I wasn't talking about seeing a warning at compile time.
I meant, when I'm editing my_driver_tansparent/opaque_driver.json
file, and using the cshema in it for help, and autocorrect with LSP (specifying "$schema": "https://github.com/Mbed-TLS/mbedtls/blob/development/ scripts/data_files/driver_jsons/driver_transparent_schema.json"
at the begining) with vscode-langservers-extracted, it will automatically set the "type":
as ["transparent"]
, but show an error about the type being string not an array. After deleting the brackets and setting "type": "transparent"
it will show a warning about type should be ["transparent"]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see, thanks. The information I was missing was that some other tool complained. Our Python script just calls Python's jsonschema
package to load the schema, and I guess that package doesn't validate the schema itself. I've filed a backlog issue about checking the validity of the schemas.
So can you please change the changelog entry to something that just says the schema was invalid? E.g.
Fix invalid JSON schemas for driver descriptions used by generate_driver_wrappers.py.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
I've kicked the CI |
cb42454
to
abb4f9a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update!
Can you please submit the same patch to the mbedtls-3.6
branch?
I created a new PR on that branch #9679 |
As I see the CI is failing on the changelog check. I will push a word wrapped version to be in the 79 columns. |
Signed-off-by: Gergely Korcsák <[email protected]>
a3c2a8f
abb4f9a
to
a3c2a8f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update!
Description
Fix the const default value for the driver schema jsons.
PR checklist
Please remove the segment/s on either side of the | symbol as appropriate, and add any relevant link/s to the end of the line.
If the provided content is part of the present PR remove the # symbol.