liveBook · Manning

Semantic versioning

As explained in Building Web APIs with ASP.NET Core

Semantic versioning is a version-numbering convention using MAJOR, MINOR, and PATCH components whose increments communicate compatibility and change significance.

Semantic versioning (SemVer) gives version numbers the form MAJOR.MINOR.PATCH. Each number signals the kind of change made, helping API clients judge whether an update should remain compatible. section 3.3.3

Increment the component that matches the change:

An API can keep older versions available while newer ones serve changed endpoints. URL-segment versioning makes those versions selectable, though maintaining them adds complexity. SemVer also permits prerelease labels and metadata; the basic three-number format is enough here. section 3.3.3

// ...
 
builder.Services.AddApiVersioning(options => {
    options.ApiVersionReader = new UrlSegmentApiVersionReader();  #1
    options.AssumeDefaultVersionWhenUnspecified = true;
    options.DefaultApiVersion = new ApiVersion(1, 0);
});
 
builder.Services.AddVersionedApiExplorer(options => {
    options.GroupNameFormat = "'v'VVV";                           #2
    options.SubstituteApiVersionInUrl = true;                     #3
});
 
// ...

This configuration selects URL-segment API versioning and sets 1.0 as the default. It illustrates version selection, not all three SemVer components. section 3.3.3

How Building Web APIs with ASP.NET Core covers it

How deep it goes
Defines the three increment rules and notes extensions without detailing them.
Examples
Uses an ASP.NET Core API configured with a default version of 1.0.
What it assumes
Assumes an existing ASP.NET Core API while defining SemVer from its basic format.
What you can do after
Evaluate/understand whether an API change calls for a major, minor, or patch increment.
How it connects
Connects semantic versioning to backward compatibility and URL-segment API versioning.

Also explained in

Compare how 8 books explain semantic versioning →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Web APIs with ASP.NET Core. The section links point to the parts of the book it draws on.