Skip to content

Fix typos in API versioning #34961

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

Merged
merged 1 commit into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public class DefaultApiVersionStrategy implements ApiVersionStrategy {
/**
* Create an instance.
* @param versionResolvers one or more resolvers to try; the first non-null
* value returned by any resolver becomes the resolved used
* @param versionParser parser for to raw version values
* value returned by any resolver becomes the value used
* @param versionParser parser for raw version values
* @param versionRequired whether a version is required; if a request
* does not have a version, and a {@code defaultVersion} is not specified,
* validation fails with {@link MissingApiVersionException}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
import org.springframework.util.Assert;

/**
* Parser for semantic API versioning with a major, minor, and patch values.
* For example "1", "1.0", "1.2", "1.2.0", "1.2.3". Leading, non-integer
* Parser for semantic API versioning with major, minor, and patch values.
* For example, "1", "1.0", "1.2", "1.2.0", "1.2.3". Leading, non-integer
* characters, as in "v1.0", are skipped.
*
* @author Rossen Stoyanchev
* @since 7.0
*/
public class SemanticApiVersionParser implements ApiVersionParser<SemanticApiVersionParser.Version> {

private static final Pattern semantinVersionPattern = Pattern.compile("^(\\d+)(\\.(\\d+))?(\\.(\\d+))?$");
private static final Pattern semanticVersionPattern = Pattern.compile("^(\\d+)(\\.(\\d+))?(\\.(\\d+))?$");


@Override
Expand All @@ -40,7 +40,7 @@ public Version parseVersion(String version) {

version = skipNonDigits(version);

Matcher matcher = semantinVersionPattern.matcher(version);
Matcher matcher = semanticVersionPattern.matcher(version);
Assert.state(matcher.matches(), "Invalid API version format");

String major = matcher.group(1);
Expand Down