question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

property order in subclass

See original GitHub issue

Say I have 2 schemas a.json and b.json that generate classes A and B. In b.json I “inherit” a.json using the “extends” mechanism.

In the generated classes A and B there is a JsonPropertyOrder annotation that specifies the correct property order; however, when serializing, B’s properties appear before A’s properties in the resulting JSON.

Is there a way to make Jackson serialize the super class properties before the subclass?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

0reactions
ogerardincommented, Mar 28, 2022

Without the PropertyOrder annotation, Jackson does the least surprising thing

IMO it’s great that the generated @JsonPropertyOrder preserves the order of the properties in the schema (I’ve tested with sourceType=yamlschema). That allows an ordering that is relevant to the doman.

Of course, but if you read all the discussion form the start, you’ll see that it’s about the order of properties when inheritance is involved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jackson: Property Order and Inheritance - java - Stack Overflow
@JsonPropertyOrder can be used to give specific order in which the details of the data expected in the output json, so using this...
Read more >
Inheritance — The Swift Programming Language (Swift 5.7)
When one class inherits from another, the inheriting class is known as a subclass, and the class it inherits from is known as...
Read more >
Subclasses of Built-In Types with Properties - MathWorks
When a subclass of a built-in class defines properties, default indexing and concatenation do not work. The default subsref , subsasgn , horzcat...
Read more >
abc — Abstract Base Classes — Python 3.11.1 documentation
Register subclass as a “virtual subclass” of this ABC. ... In order to correctly interoperate with the abstract base class machinery, the descriptor...
Read more >
FileNet P8 5.5.x - Property inheritance rules - IBM
All built-in, or system, properties assigned to a particular root class are inherited by all its subclasses. Similarly, all custom properties added to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found