Hi, this is likely just a misunderstanding on my part, but I've noticed that my custom ISchemaProcessor is invoked before the rest of the schema is generated, so in some cases, values that I set in the Process method are overwritten by the JsonSchemaGenerator. As an example, let's say I do the following:
internal class MyJsonSchemaProcessor : ISchemaProcessor
{
public void Process(SchemaProcessorContext context)
{
context.Schema.MinLength = 42;
}
What I would expect is that all properties will have minLength: 42 in the generated schema, but what I observe is that the default schema generation behavior runs after the ISchemaProcessor and overwrites values set here. Is there a way to force the values set in the ISchemaProcessor to take precedence?
Note, this is just a silly contrived example. What i'm actually trying to do is null out the minLength: 1 that is generated automatically for required string properties, and happened to notice that context.Schema.MinLength has not yet been set to 1 yet when the ISchemaProcessor runs, so I am unable to set it to null and override the default behavior. But my question here is more about clarifying my general understanding of what i'm supposed to be able to accomplish with a custom ISchemaProcessor.
Hi, this is likely just a misunderstanding on my part, but I've noticed that my custom ISchemaProcessor is invoked before the rest of the schema is generated, so in some cases, values that I set in the Process method are overwritten by the JsonSchemaGenerator. As an example, let's say I do the following:
What I would expect is that all properties will have
minLength: 42
in the generated schema, but what I observe is that the default schema generation behavior runs after the ISchemaProcessor and overwrites values set here. Is there a way to force the values set in the ISchemaProcessor to take precedence?I'm setting the processor as follows:
settings.SchemaProcessors.Add(new MyJsonSchemaProcessor());
Note, this is just a silly contrived example. What i'm actually trying to do is null out the
minLength: 1
that is generated automatically for required string properties, and happened to notice that context.Schema.MinLength has not yet been set to 1 yet when the ISchemaProcessor runs, so I am unable to set it to null and override the default behavior. But my question here is more about clarifying my general understanding of what i'm supposed to be able to accomplish with a custom ISchemaProcessor.Thank you for your time and input.