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

JSchemaGeneratorInternal does not use overridden property GenerationProviders of classes that inherit from JSchemaGenerator #211

Open
joperator opened this issue Apr 2, 2020 · 0 comments

Comments

@joperator
Copy link

Situation:
I've implemented a custom JSchemaGenerator that inherits from Newtonsoft.Json.Schema.Generation.JSchemaGenerator and uses a fixed set of JSchemaGenerationProviders that can be extended with user-defined JSchemaGenerationProviders. The JSchemaGenerationProviders are therefore stored in a private field of my custom JSchemaGenerator that can be accessed through overridden property GenerationProviders.

Problem:
When calling one of the Generate methods of my custom JSchemaGenerator, which directly refer to the corresponding Generate method of the base class, none of the specified JSchemaGenerationProviders is used.

Code issue:
A quick look at JSchemaGeneratorInternal's GenerateInternal method indicates that it uses _generator._generationProviders instead of _generator.GenerationProviders to get the JSchemaGenerationProviders of the specified JSchemaGenerator. Since I manage the JSchemaGenerationProviders of my custom JSchemaGenerator in a separate collection and do not use the base class property GenerationProviders, _generator._generationProviders always remains null.

joperator pushed a commit to joperator/Newtonsoft.Json.Schema that referenced this issue Mar 11, 2021
joperator added a commit to joperator/Newtonsoft.Json.Schema that referenced this issue Jan 6, 2022
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