Skip to content

Commit

Permalink
Merge pull request #1397 from jdimeo/feature/addtl-props-orig-order
Browse files Browse the repository at this point in the history
Use LinkedHashMap for additional properties, so the original ordering in the JSON is preserved
  • Loading branch information
joelittlejohn authored May 3, 2022
2 parents 856f5e7 + 7958a06 commit f0b606e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package org.jsonschema2pojo.rules;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Spliterator;
Expand Down Expand Up @@ -138,7 +138,7 @@ private JFieldVar addAdditionalPropertiesField(JDefinedClass jclass, JType prope
JClass propertiesMapType = jclass.owner().ref(Map.class);
propertiesMapType = propertiesMapType.narrow(jclass.owner().ref(String.class), propertyType.boxify());

JClass propertiesMapImplType = jclass.owner().ref(HashMap.class);
JClass propertiesMapImplType = jclass.owner().ref(LinkedHashMap.class);
propertiesMapImplType = propertiesMapImplType.narrow(jclass.owner().ref(String.class), propertyType.boxify());

JFieldVar field = jclass.field(JMod.PRIVATE, propertiesMapType, "additionalProperties");
Expand Down

0 comments on commit f0b606e

Please sign in to comment.