Skip to content

Commit

Permalink
refactor: replace property in jackson preset
Browse files Browse the repository at this point in the history
replace check for isAdditionalProperties with hasUnwrappedOptions when adding
@JsonAnyGetter annotation.
  • Loading branch information
memdal committed Oct 8, 2024
1 parent 3c2b25c commit fa2cccc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/generators/java/presets/JacksonPreset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,15 @@ export const JAVA_JACKSON_PRESET: JavaPreset = {
if (model.options.isExtended) {
return content;
}
const isAdditionalProperties =
property.propertyName === 'additionalProperties';
//Properties that are dictionaries with unwrapped options, cannot get the annotation because it cannot be accurately unwrapped by the jackson library.
const isDictionary =
property.property instanceof ConstrainedDictionaryModel;
const hasUnwrappedOptions =
isDictionary &&
(property.property as ConstrainedDictionaryModel).serializationType ===
'unwrap';
const blocks: string[] = [];
if (isAdditionalProperties) {
if (hasUnwrappedOptions) {
blocks.push(renderer.renderAnnotation('JsonAnyGetter'));
}
blocks.push(content);
Expand Down

0 comments on commit fa2cccc

Please sign in to comment.