-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat(config): Added json schema generator for providers #7
base: master
Are you sure you want to change the base?
Conversation
The title of the Pull Request needs to be changed. |
I need to clean up some code from my previous commits |
I'd extract the logic out of |
} | ||
} | ||
} | ||
public void addBakeryCommandFields(String providerName, Field[] fields) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add new line above
} | ||
} | ||
} | ||
public void addAccountCommandFields(String providerName, Field[] fields) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add new line above
public JSONObject providersFields = Providers.providersMetadata(); | ||
|
||
public void addProviderCommandFields(String providerName, Field[] fields) { | ||
JSONObject providerFields = (JSONObject) ((JSONObject) providersFields.get("providers")).get(providerName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the double cast? (JSONObject) ((JSONObject)....
public void addBakeryCommandFields(String providerName, Field[] fields) { | ||
JSONObject bakeryDefaultsFields = (JSONObject) ((JSONObject) ((JSONObject) providersFields.get("providers")) | ||
.get(providerName)).get("bakeryDefaultsFields"); | ||
if (providersFields != null && bakeryDefaultsFields != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might want to use Objects.equals
instead of !=
, better null safety
.get(providerName)).get("bakeryDefaultsFields"); | ||
if (providersFields != null && bakeryDefaultsFields != null) { | ||
for (Field f : fields) { | ||
if (f.getAnnotation(Parameter.class) != null && bakeryDefaultsFields.get(f.getName()) != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might want to use Objects.equals
instead of !=
, better null safety
for (Field field : fields) { | ||
accountFields.put(field.getName(), fieldType(field)); | ||
} | ||
if (providersFields != null && providersFields.get(providerName) != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might want to use Objects.equals
instead of !=
, better null safety
for (Field field : fields) { | ||
bakeryFields.put(field.getName(), fieldType(field)); | ||
} | ||
if (providersFields != null && providersFields.get(providerName) != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might want to use Objects.equals
instead of !=
, better null safety
|
||
public JSONObject fieldType(Field field) { | ||
JSONObject typeWrapper = new JSONObject(); | ||
if (field.getAnnotation(LocalFile.class) != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might want to use Objects.equals
instead of !=
, better null safety
JSONObject typeWrapper = new JSONObject(); | ||
if (field.getAnnotation(LocalFile.class) != null) { | ||
typeWrapper.put("type", "upload"); | ||
} else if (field.getAnnotation(Secret.class) != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might want to use Objects.equals
instead of !=
, better null safety
ea85c0e
to
cc2d1ec
Compare
No description provided.