CustomDefinitionProvider on void Methods #440
-
Hello, I have a class with a very basic void method:
I am trying to implement a custom logic to the generated schema using a CustomPropertyDefinitionProvider:
While this works great for non void methods, it seems that void methods are not included with the forMethods() configuration. The options im using are: The resulting schema does contain the void methods but without the customDefinition: Is there something I am missing here? Any clue on how to proceed from here is greatly appreciated as I have been on this for a while now. Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @PintOfBitter, I can confirm your observation and can reproduce it. Any custom definition would only be considered after this check. An extra caveat could be added to enable at least such a EDIT: I've made the requisite change in #441 and plan to release it as v4.35.0. |
Beta Was this translation helpful? Give feedback.
Hi @PintOfBitter,
I can confirm your observation and can reproduce it.
The reason for that behavior is this short-circuiting logic for
void
methods at the moment:jsonschema-generator/jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/impl/SchemaGenerationContextImpl.java
Lines 593 to 596 in f226ad9
Any custom definition would only be considered after this check.
Out of curiosity: what kind of schema do you intend to assign to such a
void
method's return value?An extra caveat could be…