Skip to content

Conversation

develpoerX
Copy link
Contributor

…ialization using swagger to parse different JDK versions.

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a JIRA issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [SCB-XXX] Fixes bug in ApproximateQuantiles, where you replace SCB-XXX with the appropriate JIRA issue.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean install -Pit to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

…ialization using swagger to parse different JDK versions.
@coveralls
Copy link

coveralls commented Oct 26, 2020

Coverage Status

Coverage decreased (-0.03%) to 86.379% when pulling 3f69f3b on develpoerX:zyl2-1.3.x into d4e2a7c on apache:1.3.x.

public boolean isIgnoreSwaggerDifferent() {
DynamicBooleanProperty property =
DynamicPropertyFactory.getInstance()
.getBooleanProperty("servicecomb.service.registry.instance.ignoreSwaggerDifferent",
Copy link
Contributor

Choose a reason for hiding this comment

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

Difference

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your suggestion.

<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.22</version>
Copy link
Contributor

Choose a reason for hiding this comment

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

do not add version, use dependency management if neccessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

}

private boolean isIllegalValue(String context) {
if (context == null || context == "" || context.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

use StringUtils.isEmpty from commons lang 3

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

|| ServiceRegistryConfig.INSTANCE.isAlwaysOverrideSchema();
}

private boolean isIllegalValue(String context) {
Copy link
Contributor

Choose a reason for hiding this comment

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

delete this method because should be is valid value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

scSchemaContent,
localSchemaContent);
}
return false;
Copy link
Contributor

Choose a reason for hiding this comment

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

return true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

localSchemaEntry.getKey(),
scSchemaContent,
localSchemaContent);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This block should executed when not equals.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

</dependency>
<dependency>
<groupId>org.apache.servicecomb</groupId>
<artifactId>swagger-generator-core</artifactId>
Copy link
Contributor

Choose a reason for hiding this comment

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

duplicated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your suggestions

if (ServiceRegistryConfig.INSTANCE.isIgnoreSwaggerDifference()) {
LOGGER.warn(
"service center schema and local schema both are different:\n service center schema:\n[{}]\n local schema:\n[{}]"
+ "\nYou need to increment microservice version before deploying. "
Copy link
Contributor

Choose a reason for hiding this comment

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

service center schema and local schema both are different:\n service center schema:\n[{}]\n local schema:\n[{}]"
+ "\nYou have configured to ignore difference check. It's recommented to increment microservice version before deploying when shcema change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

if (scSwagger.equals(localSwagger)) {
return true;
}
if (ServiceRegistryConfig.INSTANCE.isIgnoreSwaggerDifference()) {
Copy link
Contributor

@liubao68 liubao68 Oct 27, 2020

Choose a reason for hiding this comment

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

put if (ServiceRegistryConfig.INSTANCE.isIgnoreSwaggerDifference()) { outside of

if (!StringUtils.isEmpty(scSchemaContent) && !StringUtils.isEmpty(localSchemaContent)) {

block.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. I have put it behind EQUALS block.

@liubao68 liubao68 merged commit 5b8c612 into apache:1.3.x Oct 27, 2020
@develpoerX develpoerX deleted the zyl2-1.3.x branch December 24, 2020 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants