Skip to content

How to solve when using configpart.withInstanceAttributeOverride() on array field, the new Node will be added to items Node #270

Discussion options

You must be logged in to vote

Hi @manchuanxingmengyaxinhe,

The corresponding part from the documentation is this (point 3 in the yellow box):
https://victools.github.io/jsonschema-generator/#generator-individual-configurations

You may want to specifically consider or return null for cases where FieldScope.isFakeContainerItemScope()/MethodScope.isFakeContainerItemScope() returns true.
Because each individual configuration added via .forField() or .forMethods() is being called upon twice if the encountered type is a "container" (i.e. an array or subtype of Collection).

The schema generation will be triggered twice on a field/method with a collection type.

  1. The first time, the FieldScope in your case would return:
    • get…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@manchuanxingmengyaxinhe
Comment options

Answer selected by manchuanxingmengyaxinhe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants