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

Ignore static fields in SpringObjectBuilder #207

Closed
stagr opened this Issue Aug 31, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@stagr

stagr commented Aug 31, 2016

When using JSONDoc with Spring MVC it automatically generates documentation also for "static" fields causing the UI to show them in the list of fields and in the prefilled JSON in the playground.

Example:

public class Pojo {
  ...
  private static final long serialVersionUID = 1234;
  ...
}

generates the following in the list of fields of Pojo class:

serialVersionUID Type: long

and the following in the prefilled JSON in the playground:

{
  ...
  "serialVersionUID": 0,
  ...
}

A solution is simply to ignore all static fields when iterating over all fields in the SpringObjectBuilder:

for (Field field : clazz.getDeclaredFields()) {

  // Only add fields that are not static
  if (!Modifier.isStatic(field.getModifiers())) {
    ApiObjectFieldDoc fieldDoc = new ApiObjectFieldDoc();
   ...
  }
  ...
}
@MonkeyTonk

This comment has been minimized.

Show comment
Hide comment
@MonkeyTonk

MonkeyTonk Dec 28, 2016

I think PR #217 of issue #215 by @osigge should solve this problem. Maybe issues #207 and #215 should be merged.

MonkeyTonk commented Dec 28, 2016

I think PR #217 of issue #215 by @osigge should solve this problem. Maybe issues #207 and #215 should be merged.

@fabiomaffioletti

This comment has been minimized.

Show comment
Hide comment
@fabiomaffioletti

fabiomaffioletti Nov 20, 2017

Owner

Solved with #217

Owner

fabiomaffioletti commented Nov 20, 2017

Solved with #217

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment