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

Make yaml dependency optional #840

Closed
alturkovic opened this issue Jul 22, 2023 · 4 comments · Fixed by #931
Closed

Make yaml dependency optional #840

alturkovic opened this issue Jul 22, 2023 · 4 comments · Fixed by #931

Comments

@alturkovic
Copy link

alturkovic commented Jul 22, 2023

I tried to parse a json-schema like: JsonSchemaFactory.getInstance(version).getSchema(schema) That produces an exception if you do not have jackson-dataformat-yaml dependency even though I do not want to use YAML because the internal builder (com.networknt.schema.JsonSchemaFactory.Builder) uses an instance of YamlMapper upon construction.

This should be revised to be able to use the library without the dependency.

@fdutton
Copy link
Contributor

fdutton commented Jul 29, 2023

@alturkovic @stevehu YAML support was added 2023-03-04 (0815871) and published in version 1.0.78.

While it would be simple to make the dependency on jackson-dataformat-yaml optional, it would break any client that started using this feature after its introduction. These clients will now be required to explicitly declare a dependency on jackson-dataformat-yaml when they previously relied on Maven's transitive dependency resolution.

Should we add this change to 1.1.x or should we make the change now, provide migration instructions and assume the impact will be small?

@stevehu
Copy link
Contributor

stevehu commented Aug 1, 2023

The jackson-dataformat-yaml is a dependency in the pom.xml and would be included in your target application as a transitive dependency. How it would be missing? If possible, I don't think making this an optional dependency.

@alturkovic
Copy link
Author

What I meant was, I tried excluding the jackson-dataformat-yaml dependency when importing this library using maven since I am not interested in the yaml format at all. I hoped that it would be possible to exclude it for users who are only interested in JSON format.

@stevehu
Copy link
Contributor

stevehu commented Aug 24, 2023

It is not possible as partial code depends on it during runtime.

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

Successfully merging a pull request may close this issue.

3 participants