-
Notifications
You must be signed in to change notification settings - Fork 218
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
Skip unrecognized JSON files when loading models #1846
Conversation
794eb0a
to
c2113f1
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.
Looks like issues with Windows CI, I had issues with Paths.get
formatting Windows paths improperly because they needed to be URIs to encode correctly.
smithy-model/src/main/java/software/amazon/smithy/model/loader/ModelLoader.java
Outdated
Show resolved
Hide resolved
smithy-model/src/test/java/software/amazon/smithy/model/JarUtils.java
Outdated
Show resolved
Hide resolved
smithy-model/src/test/java/software/amazon/smithy/model/JarUtils.java
Outdated
Show resolved
Hide resolved
c2113f1
to
61fcec8
Compare
smithy-model/src/test/java/software/amazon/smithy/model/loader/ModelAssemblerTest.java
Outdated
Show resolved
Hide resolved
61fcec8
to
9937a40
Compare
This commit updates the model loading process so that JSON files that are not objects or that don't contain a top-level "smithy" key are skipped. This can be useful when loading directories that contain Smithy models mixed with other JSON files. JAR files that contain Smithy models are not permitted to refer to unrecognized JSON files that lack a valid "smithy" version key/value pair. This commit also only creates InputStreams for files that Smithy can actually load or attempt to load. Smithy would previously open an InputStream for all recursive files in a directory even if it was unable to load the file based on the filename. It now only creates an InputStream when the file has a .json, .smithy, or no file extension. Closes #1841
9937a40
to
328c955
Compare
@mtdowling do you have a timeline for the next release? This and #1838 would be really nice to have for my team. |
We're planning for a Monday release |
awesome, thanks! |
Issue #, if available: #1841
Description of changes:
This commit updates the model loading process so that JSON files that are not objects or that don't contain a top-level "smithy" key are skipped. This can be useful when loading directories that contain Smithy models mixed with other JSON files. JAR files that contain Smithy models are not permitted to refer to unrecognized JSON files that lack a valid "smithy" version key/value pair.
This commit also only creates InputStreams for files that Smithy can actually load or attempt to load. Smithy would previously open an InputStream for all recursive files in a directory even if it was unable to load the file based on the filename. It now only creates an InputStream when the file has a .json, .smithy, or no file extension.
Closes #1841
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.