Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java-client][java-jaxrs-server][jackson] Add @JsonPropertyOrder to models #3778

Merged
merged 5 commits into from
Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {{import}};
import java.io.Serializable;
{{/serializableModel}}
{{#jackson}}
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
{{#withXml}}
import com.fasterxml.jackson.dataformat.xml.annotation.*;
{{/withXml}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
* {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
*/{{#description}}
@ApiModel(description = "{{{description}}}"){{/description}}
{{#jackson}}
@JsonPropertyOrder({
{{#vars}}
{{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}}
{{/vars}}
})
{{/jackson}}
{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}}
public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcelableModel}}implements Parcelable {{#serializableModel}}, Serializable {{/serializableModel}}{{/parcelableModel}}{{^parcelableModel}}{{#serializableModel}}implements Serializable {{/serializableModel}}{{/parcelableModel}}{
{{#serializableModel}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import org.apache.commons.lang3.ObjectUtils;
{{/supportJava6}}
{{#imports}}import {{import}};
{{/imports}}
{{#jackson}}
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
{{/jackson}}
{{#serializableModel}}
import java.io.Serializable;
{{/serializableModel}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
* {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
*/{{#description}}
@ApiModel(description = "{{{description}}}"){{/description}}
{{#jackson}}
@JsonPropertyOrder({
{{#vars}}
{{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}}
{{/vars}}
})
{{/jackson}}
{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
{{#vars}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* AdditionalPropertiesAnyType
*/
@JsonPropertyOrder({
AdditionalPropertiesAnyType.JSON_PROPERTY_NAME
})

public class AdditionalPropertiesAnyType extends HashMap<String, Object> {
public static final String JSON_PROPERTY_NAME = "name";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* AdditionalPropertiesArray
*/
@JsonPropertyOrder({
AdditionalPropertiesArray.JSON_PROPERTY_NAME
})

public class AdditionalPropertiesArray extends HashMap<String, List> {
public static final String JSON_PROPERTY_NAME = "name";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* AdditionalPropertiesBoolean
*/
@JsonPropertyOrder({
AdditionalPropertiesBoolean.JSON_PROPERTY_NAME
})

public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> {
public static final String JSON_PROPERTY_NAME = "name";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,24 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* AdditionalPropertiesClass
*/
@JsonPropertyOrder({
AdditionalPropertiesClass.JSON_PROPERTY_MAP_STRING,
AdditionalPropertiesClass.JSON_PROPERTY_MAP_NUMBER,
AdditionalPropertiesClass.JSON_PROPERTY_MAP_INTEGER,
AdditionalPropertiesClass.JSON_PROPERTY_MAP_BOOLEAN,
AdditionalPropertiesClass.JSON_PROPERTY_MAP_ARRAY_INTEGER,
AdditionalPropertiesClass.JSON_PROPERTY_MAP_ARRAY_ANYTYPE,
AdditionalPropertiesClass.JSON_PROPERTY_MAP_MAP_STRING,
AdditionalPropertiesClass.JSON_PROPERTY_MAP_MAP_ANYTYPE,
AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE1,
AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE2,
AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE3
})

public class AdditionalPropertiesClass {
public static final String JSON_PROPERTY_MAP_STRING = "map_string";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* AdditionalPropertiesInteger
*/
@JsonPropertyOrder({
AdditionalPropertiesInteger.JSON_PROPERTY_NAME
})

public class AdditionalPropertiesInteger extends HashMap<String, Integer> {
public static final String JSON_PROPERTY_NAME = "name";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* AdditionalPropertiesNumber
*/
@JsonPropertyOrder({
AdditionalPropertiesNumber.JSON_PROPERTY_NAME
})

public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> {
public static final String JSON_PROPERTY_NAME = "name";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* AdditionalPropertiesObject
*/
@JsonPropertyOrder({
AdditionalPropertiesObject.JSON_PROPERTY_NAME
})

public class AdditionalPropertiesObject extends HashMap<String, Map> {
public static final String JSON_PROPERTY_NAME = "name";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* AdditionalPropertiesString
*/
@JsonPropertyOrder({
AdditionalPropertiesString.JSON_PROPERTY_NAME
})

public class AdditionalPropertiesString extends HashMap<String, String> {
public static final String JSON_PROPERTY_NAME = "name";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* Animal
*/
@JsonPropertyOrder({
Animal.JSON_PROPERTY_CLASS_NAME,
Animal.JSON_PROPERTY_COLOR
})

@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true)
@JsonSubTypes({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* ArrayOfArrayOfNumberOnly
*/
@JsonPropertyOrder({
ArrayOfArrayOfNumberOnly.JSON_PROPERTY_ARRAY_ARRAY_NUMBER
})

public class ArrayOfArrayOfNumberOnly {
public static final String JSON_PROPERTY_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* ArrayOfNumberOnly
*/
@JsonPropertyOrder({
ArrayOfNumberOnly.JSON_PROPERTY_ARRAY_NUMBER
})

public class ArrayOfNumberOnly {
public static final String JSON_PROPERTY_ARRAY_NUMBER = "ArrayNumber";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@
import java.util.ArrayList;
import java.util.List;
import org.openapitools.client.model.ReadOnlyFirst;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* ArrayTest
*/
@JsonPropertyOrder({
ArrayTest.JSON_PROPERTY_ARRAY_OF_STRING,
ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER,
ArrayTest.JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL
})

public class ArrayTest {
public static final String JSON_PROPERTY_ARRAY_OF_STRING = "array_of_string";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,19 @@
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* Capitalization
*/
@JsonPropertyOrder({
Capitalization.JSON_PROPERTY_SMALL_CAMEL,
Capitalization.JSON_PROPERTY_CAPITAL_CAMEL,
Capitalization.JSON_PROPERTY_SMALL_SNAKE,
Capitalization.JSON_PROPERTY_CAPITAL_SNAKE,
Capitalization.JSON_PROPERTY_SC_A_E_T_H_FLOW_POINTS,
Capitalization.JSON_PROPERTY_A_T_T_N_A_M_E
})

public class Capitalization {
public static final String JSON_PROPERTY_SMALL_CAMEL = "smallCamel";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@
import io.swagger.annotations.ApiModelProperty;
import org.openapitools.client.model.Animal;
import org.openapitools.client.model.CatAllOf;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* Cat
*/
@JsonPropertyOrder({
Cat.JSON_PROPERTY_DECLAWED
})

public class Cat extends Animal {
public static final String JSON_PROPERTY_DECLAWED = "declawed";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* CatAllOf
*/
@JsonPropertyOrder({
CatAllOf.JSON_PROPERTY_DECLAWED
})

public class CatAllOf {
public static final String JSON_PROPERTY_DECLAWED = "declawed";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* Category
*/
@JsonPropertyOrder({
Category.JSON_PROPERTY_ID,
Category.JSON_PROPERTY_NAME
})

public class Category {
public static final String JSON_PROPERTY_ID = "id";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* Model for testing model with \&quot;_class\&quot; property
*/
@ApiModel(description = "Model for testing model with \"_class\" property")
@JsonPropertyOrder({
ClassModel.JSON_PROPERTY_PROPERTY_CLASS
})

public class ClassModel {
public static final String JSON_PROPERTY_PROPERTY_CLASS = "_class";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* Client
*/
@JsonPropertyOrder({
Client.JSON_PROPERTY_CLIENT
})

public class Client {
public static final String JSON_PROPERTY_CLIENT = "client";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@
import io.swagger.annotations.ApiModelProperty;
import org.openapitools.client.model.Animal;
import org.openapitools.client.model.DogAllOf;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* Dog
*/
@JsonPropertyOrder({
Dog.JSON_PROPERTY_BREED
})

public class Dog extends Animal {
public static final String JSON_PROPERTY_BREED = "breed";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* DogAllOf
*/
@JsonPropertyOrder({
DogAllOf.JSON_PROPERTY_BREED
})

public class DogAllOf {
public static final String JSON_PROPERTY_BREED = "breed";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* EnumArrays
*/
@JsonPropertyOrder({
EnumArrays.JSON_PROPERTY_JUST_SYMBOL,
EnumArrays.JSON_PROPERTY_ARRAY_ENUM
})

public class EnumArrays {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
Expand Down
Loading