Skip to content
This repository was archived by the owner on Dec 31, 2025. It is now read-only.

Ap 8726 - Update library to support all current APIs.#11

Open
tcochran317 wants to merge 6 commits intomasterfrom
AP-8726
Open

Ap 8726 - Update library to support all current APIs.#11
tcochran317 wants to merge 6 commits intomasterfrom
AP-8726

Conversation

@tcochran317
Copy link

No description provided.

@tcochran317
Copy link
Author

Also found and fixed a few API issues while testing this: https://github.com/apruve/apruve/pull/3364

Copy link

@simonbtomlinson simonbtomlinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll finish looking at this tomorrow, but I pretty much understand what's going on and it seems good so far, with minor questions.

public String getName() {
return name;
}
public void setName(String name) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would anyone ever need to set a name? Our api doesn't support creating users.
Or is this required by the serialization library?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a Java thing. If there's no public setter method nothing outside of the class (like a JSON deserializer) can modify the property.


protected static String doMarshalTest(Object obj) {
String json = JsonUtil.getInstance().toJson(obj);
System.out.println(obj.getClass().getName() + ":" + json);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to be printing stuff during tests?


public class ApruveModelTestHelper {

protected static String doMarshalTest(Object obj) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the point here just to make sure it doesn't throw any errors? Or are we missing something that tests that it marshals back to a reasonable representation?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's looking for configuration problems which would throw exceptions from the serialization framework. Though I realize in trying to DRY out the code I inadvertently switched to a serialization method that intentionally fails without throwing an exception. Whoops.

Copy link

@simonbtomlinson simonbtomlinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! The mapper isn't threadsafe is the only thing I can think of, but I really doubt that'll come up.

@tcochran317
Copy link
Author

Actually, ObjectMapper is thread safe so long as threads don't change the configuration of the mapper (which this implementation does not allow). https://stackoverflow.com/questions/3907929/should-i-declare-jacksons-objectmapper-as-a-static-field

@sam-apruve sam-apruve added the Old label Mar 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants